Skip to content

Commit e1c1c30

Browse files
committed
Pre branch pgindent / pgperltidy run
Along the way make a slight adjustment to src/include/utils/queryjumble.h to avoid an unused typedef.
1 parent c318337 commit e1c1c30

File tree

19 files changed

+94
-76
lines changed

19 files changed

+94
-76
lines changed

src/backend/access/heap/hio.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,8 @@ RelationGetBufferForTuple(Relation relation, Size len,
410410
}
411411

412412
/*
413-
* If the FSM knows nothing of the rel, try the last page before we
414-
* give up and extend. This avoids one-tuple-per-page syndrome during
413+
* If the FSM knows nothing of the rel, try the last page before we give
414+
* up and extend. This avoids one-tuple-per-page syndrome during
415415
* bootstrapping or in a recently-started system.
416416
*/
417417
if (targetBlock == InvalidBlockNumber)

src/backend/catalog/genbki.pl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -890,11 +890,11 @@ sub morph_row_for_pgattr
890890
# Copy the type data from pg_type, and add some type-dependent items
891891
my $type = $types{$atttype};
892892

893-
$row->{atttypid} = $type->{oid};
894-
$row->{attlen} = $type->{typlen};
895-
$row->{attbyval} = $type->{typbyval};
896-
$row->{attalign} = $type->{typalign};
897-
$row->{attstorage} = $type->{typstorage};
893+
$row->{atttypid} = $type->{oid};
894+
$row->{attlen} = $type->{typlen};
895+
$row->{attbyval} = $type->{typbyval};
896+
$row->{attalign} = $type->{typalign};
897+
$row->{attstorage} = $type->{typstorage};
898898
$row->{attcompression} = '\0';
899899

900900
# set attndims if it's an array type

src/backend/catalog/heap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2294,7 +2294,7 @@ StoreAttrDefault(Relation rel, AttrNumber attnum,
22942294
valuesAtt[Anum_pg_attribute_atthasdef - 1] = true;
22952295
replacesAtt[Anum_pg_attribute_atthasdef - 1] = true;
22962296

2297-
if (rel->rd_rel->relkind == RELKIND_RELATION && add_column_mode &&
2297+
if (rel->rd_rel->relkind == RELKIND_RELATION && add_column_mode &&
22982298
!attgenerated)
22992299
{
23002300
expr2 = expression_planner(expr2);

src/backend/executor/nodeModifyTable.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -704,16 +704,16 @@ ExecInsert(ModifyTableState *mtstate,
704704
}
705705

706706
/*
707-
* Initialize the batch slots. We don't know how many slots will be
708-
* needed, so we initialize them as the batch grows, and we keep
709-
* them across batches. To mitigate an inefficiency in how resource
710-
* owner handles objects with many references (as with many slots
711-
* all referencing the same tuple descriptor) we copy the tuple
712-
* descriptor for each slot.
707+
* Initialize the batch slots. We don't know how many slots will
708+
* be needed, so we initialize them as the batch grows, and we
709+
* keep them across batches. To mitigate an inefficiency in how
710+
* resource owner handles objects with many references (as with
711+
* many slots all referencing the same tuple descriptor) we copy
712+
* the tuple descriptor for each slot.
713713
*/
714714
if (resultRelInfo->ri_NumSlots >= resultRelInfo->ri_NumSlotsInitialized)
715715
{
716-
TupleDesc tdesc = CreateTupleDescCopy(slot->tts_tupleDescriptor);
716+
TupleDesc tdesc = CreateTupleDescCopy(slot->tts_tupleDescriptor);
717717

718718
resultRelInfo->ri_Slots[resultRelInfo->ri_NumSlots] =
719719
MakeSingleTupleTableSlot(tdesc, slot->tts_ops);
@@ -3173,7 +3173,7 @@ ExecEndModifyTable(ModifyTableState *node)
31733173
*/
31743174
for (i = 0; i < node->mt_nrels; i++)
31753175
{
3176-
int j;
3176+
int j;
31773177
ResultRelInfo *resultRelInfo = node->resultRelInfo + i;
31783178

31793179
if (!resultRelInfo->ri_usesFdwDirectModify &&
@@ -3183,8 +3183,9 @@ ExecEndModifyTable(ModifyTableState *node)
31833183
resultRelInfo);
31843184

31853185
/*
3186-
* Cleanup the initialized batch slots. This only matters for FDWs with
3187-
* batching, but the other cases will have ri_NumSlotsInitialized == 0.
3186+
* Cleanup the initialized batch slots. This only matters for FDWs
3187+
* with batching, but the other cases will have ri_NumSlotsInitialized
3188+
* == 0.
31883189
*/
31893190
for (j = 0; j < resultRelInfo->ri_NumSlotsInitialized; j++)
31903191
{

src/backend/replication/logical/reorderbuffer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2215,8 +2215,8 @@ ReorderBufferProcessTXN(ReorderBuffer *rb, ReorderBufferTXN *txn,
22152215
change_done:
22162216

22172217
/*
2218-
* If speculative insertion was confirmed, the record isn't
2219-
* needed anymore.
2218+
* If speculative insertion was confirmed, the record
2219+
* isn't needed anymore.
22202220
*/
22212221
if (specinsert != NULL)
22222222
{

src/backend/replication/logical/tablesync.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ fetch_remote_table_info(char *nspname, char *relname,
759759
" ORDER BY a.attnum",
760760
lrel->remoteid,
761761
(walrcv_server_version(LogRepWorkerWalRcvConn) >= 120000 ?
762-
"AND a.attgenerated = ''" : ""),
762+
"AND a.attgenerated = ''" : ""),
763763
lrel->remoteid);
764764
res = walrcv_exec(LogRepWorkerWalRcvConn, cmd.data,
765765
lengthof(attrRow), attrRow);

src/backend/replication/pgoutput/pgoutput.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,8 @@ get_rel_sync_entry(PGOutputData *data, Oid relid)
10311031
entry->pubactions.pubinsert = entry->pubactions.pubupdate =
10321032
entry->pubactions.pubdelete = entry->pubactions.pubtruncate = false;
10331033
entry->publish_as_relid = InvalidOid;
1034-
entry->map = NULL; /* will be set by maybe_send_schema() if needed */
1034+
entry->map = NULL; /* will be set by maybe_send_schema() if
1035+
* needed */
10351036
}
10361037

10371038
/* Validate the entry */

src/backend/storage/ipc/procarray.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1974,7 +1974,7 @@ GetOldestNonRemovableTransactionId(Relation rel)
19741974
if (rel == NULL || rel->rd_rel->relisshared || RecoveryInProgress())
19751975
return horizons.shared_oldest_nonremovable;
19761976
else if (IsCatalogRelation(rel) ||
1977-
RelationIsAccessibleInLogicalDecoding(rel))
1977+
RelationIsAccessibleInLogicalDecoding(rel))
19781978
return horizons.catalog_oldest_nonremovable;
19791979
else if (RELATION_IS_LOCAL(rel))
19801980
return horizons.temp_oldest_nonremovable;

src/bin/pgbench/t/001_pgbench_with_server.pl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,7 @@ sub pgbench
10931093
],
10941094
[ 'gset alone', 1, [qr{gset must follow an SQL command}], q{\gset} ],
10951095
[
1096-
'gset no SQL', 1,
1096+
'gset no SQL', 1,
10971097
[qr{gset must follow an SQL command}], q{\set i +1
10981098
\gset}
10991099
],
@@ -1102,7 +1102,7 @@ sub pgbench
11021102
[qr{too many arguments}], q{SELECT 1 \gset a b}
11031103
],
11041104
[
1105-
'gset after gset', 1,
1105+
'gset after gset', 1,
11061106
[qr{gset must follow an SQL command}], q{SELECT 1 AS i \gset
11071107
\gset}
11081108
],
@@ -1197,7 +1197,7 @@ sub check_pgbench_logs
11971197
my $contents_raw = slurp_file($log);
11981198

11991199
my @contents = split(/\n/, $contents_raw);
1200-
my $clen = @contents;
1200+
my $clen = @contents;
12011201
ok( $min <= $clen && $clen <= $max,
12021202
"transaction count for $log ($clen)");
12031203
my $clen_match = grep(/$re/, @contents);

src/include/nodes/execnodes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ typedef struct ResultRelInfo
462462

463463
/* batch insert stuff */
464464
int ri_NumSlots; /* number of slots in the array */
465-
int ri_NumSlotsInitialized; /* number of initialized slots */
465+
int ri_NumSlotsInitialized; /* number of initialized slots */
466466
int ri_BatchSize; /* max slots inserted in a single batch */
467467
TupleTableSlot **ri_Slots; /* input tuples for batch insert */
468468
TupleTableSlot **ri_PlanSlots;

src/include/utils/queryjumble.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ typedef struct JumbleState
5353
} JumbleState;
5454

5555
/* Values for the compute_query_id GUC */
56-
typedef enum
56+
enum ComputeQueryIdType
5757
{
5858
COMPUTE_QUERY_ID_OFF,
5959
COMPUTE_QUERY_ID_ON,
6060
COMPUTE_QUERY_ID_AUTO
61-
} ComputeQueryIdType;
61+
};
6262

6363
/* GUC parameters */
6464
extern int compute_query_id;

src/test/perl/PostgresNode.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2126,8 +2126,8 @@ sub poll_query_until
21262126
$expected = 't' unless defined($expected); # default value
21272127

21282128
my $cmd = [
2129-
$self->installed_command('psql'),
2130-
'-XAt', '-d', $self->connstr($dbname)
2129+
$self->installed_command('psql'), '-XAt',
2130+
'-d', $self->connstr($dbname)
21312131
];
21322132
my ($stdout, $stderr);
21332133
my $max_attempts = 180 * 10;

src/test/recovery/t/005_replay_delay.pl

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -64,38 +64,39 @@
6464
$node_standby2->start;
6565

6666
# Recovery is not yet paused.
67-
is($node_standby2->safe_psql('postgres',
68-
"SELECT pg_get_wal_replay_pause_state()"),
69-
'not paused', 'pg_get_wal_replay_pause_state() reports not paused');
67+
is( $node_standby2->safe_psql(
68+
'postgres', "SELECT pg_get_wal_replay_pause_state()"),
69+
'not paused',
70+
'pg_get_wal_replay_pause_state() reports not paused');
7071

7172
# Request to pause recovery and wait until it's actually paused.
7273
$node_standby2->safe_psql('postgres', "SELECT pg_wal_replay_pause()");
7374
$node_primary->safe_psql('postgres',
7475
"INSERT INTO tab_int VALUES (generate_series(21,30))");
7576
$node_standby2->poll_query_until('postgres',
7677
"SELECT pg_get_wal_replay_pause_state() = 'paused'")
77-
or die "Timed out while waiting for recovery to be paused";
78+
or die "Timed out while waiting for recovery to be paused";
7879

7980
# Even if new WAL records are streamed from the primary,
8081
# recovery in the paused state doesn't replay them.
81-
my $receive_lsn = $node_standby2->safe_psql('postgres',
82-
"SELECT pg_last_wal_receive_lsn()");
83-
my $replay_lsn = $node_standby2->safe_psql('postgres',
84-
"SELECT pg_last_wal_replay_lsn()");
82+
my $receive_lsn =
83+
$node_standby2->safe_psql('postgres', "SELECT pg_last_wal_receive_lsn()");
84+
my $replay_lsn =
85+
$node_standby2->safe_psql('postgres', "SELECT pg_last_wal_replay_lsn()");
8586
$node_primary->safe_psql('postgres',
8687
"INSERT INTO tab_int VALUES (generate_series(31,40))");
8788
$node_standby2->poll_query_until('postgres',
8889
"SELECT '$receive_lsn'::pg_lsn < pg_last_wal_receive_lsn()")
89-
or die "Timed out while waiting for new WAL to be streamed";
90-
is($node_standby2->safe_psql('postgres',
91-
"SELECT pg_last_wal_replay_lsn()"),
92-
qq($replay_lsn), 'no WAL is replayed in the paused state');
90+
or die "Timed out while waiting for new WAL to be streamed";
91+
is( $node_standby2->safe_psql('postgres', "SELECT pg_last_wal_replay_lsn()"),
92+
qq($replay_lsn),
93+
'no WAL is replayed in the paused state');
9394

9495
# Request to resume recovery and wait until it's actually resumed.
9596
$node_standby2->safe_psql('postgres', "SELECT pg_wal_replay_resume()");
9697
$node_standby2->poll_query_until('postgres',
97-
"SELECT pg_get_wal_replay_pause_state() = 'not paused' AND pg_last_wal_replay_lsn() > '$replay_lsn'::pg_lsn")
98-
or die "Timed out while waiting for recovery to be resumed";
98+
"SELECT pg_get_wal_replay_pause_state() = 'not paused' AND pg_last_wal_replay_lsn() > '$replay_lsn'::pg_lsn"
99+
) or die "Timed out while waiting for recovery to be resumed";
99100

100101
# Check that the paused state ends and promotion continues if a promotion
101102
# is triggered while recovery is paused.
@@ -107,6 +108,5 @@
107108
or die "Timed out while waiting for recovery to be paused";
108109

109110
$node_standby2->promote;
110-
$node_standby2->poll_query_until('postgres',
111-
"SELECT NOT pg_is_in_recovery()")
111+
$node_standby2->poll_query_until('postgres', "SELECT NOT pg_is_in_recovery()")
112112
or die "Timed out while waiting for promotion to finish";

src/test/recovery/t/025_stuck_on_old_timeline.pl

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,14 @@
3232
$perlbin =~ s!\\!/!g if $TestLib::windows_os;
3333
my $archivedir_primary = $node_primary->archive_dir;
3434
$archivedir_primary =~ s!\\!/!g if $TestLib::windows_os;
35-
$node_primary->append_conf('postgresql.conf', qq(
35+
$node_primary->append_conf(
36+
'postgresql.conf', qq(
3637
archive_command = '"$perlbin" "$FindBin::RealBin/cp_history_files" "%p" "$archivedir_primary/%f"'
3738
wal_keep_size=128MB
3839
));
3940
# Make sure that Msys perl doesn't complain about difficulty in setting locale
4041
# when called from the archive_command.
41-
local $ENV{PERL_BADLANG}=0;
42+
local $ENV{PERL_BADLANG} = 0;
4243
$node_primary->start;
4344

4445
# Take backup from primary
@@ -47,8 +48,11 @@
4748

4849
# Create streaming standby linking to primary
4950
my $node_standby = get_new_node('standby');
50-
$node_standby->init_from_backup($node_primary, $backup_name,
51-
allows_streaming => 1, has_streaming => 1, has_archiving => 1);
51+
$node_standby->init_from_backup(
52+
$node_primary, $backup_name,
53+
allows_streaming => 1,
54+
has_streaming => 1,
55+
has_archiving => 1);
5256
$node_standby->start;
5357

5458
# Take backup of standby, use -Xnone so that pg_wal is empty.
@@ -60,17 +64,17 @@
6064
$node_cascade->init_from_backup($node_standby, $backup_name,
6165
has_streaming => 1);
6266
$node_cascade->enable_restoring($node_primary);
63-
$node_cascade->append_conf('postgresql.conf', qq(
67+
$node_cascade->append_conf(
68+
'postgresql.conf', qq(
6469
recovery_target_timeline='latest'
6570
));
6671

6772
# Promote the standby.
6873
$node_standby->promote;
6974

7075
# Wait for promotion to complete
71-
$node_standby->poll_query_until('postgres',
72-
"SELECT NOT pg_is_in_recovery();")
73-
or die "Timed out while waiting for promotion";
76+
$node_standby->poll_query_until('postgres', "SELECT NOT pg_is_in_recovery();")
77+
or die "Timed out while waiting for promotion";
7478

7579
# Find next WAL segment to be archived
7680
my $walfile_to_be_archived = $node_standby->safe_psql('postgres',

src/test/subscription/t/001_rep_changes.pl

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,11 @@
5151
"ALTER TABLE tab_nothing REPLICA IDENTITY NOTHING");
5252

5353
# Replicate the changes without replica identity index
54-
$node_publisher->safe_psql('postgres', "CREATE TABLE tab_no_replidentity_index(c1 int)");
55-
$node_publisher->safe_psql('postgres', "CREATE INDEX idx_no_replidentity_index ON tab_no_replidentity_index(c1)");
54+
$node_publisher->safe_psql('postgres',
55+
"CREATE TABLE tab_no_replidentity_index(c1 int)");
56+
$node_publisher->safe_psql('postgres',
57+
"CREATE INDEX idx_no_replidentity_index ON tab_no_replidentity_index(c1)"
58+
);
5659

5760
# Setup structure on subscriber
5861
$node_subscriber->safe_psql('postgres', "CREATE TABLE tab_notrep (a int)");
@@ -78,8 +81,11 @@
7881
);
7982

8083
# replication of the table without replica identity index
81-
$node_subscriber->safe_psql('postgres', "CREATE TABLE tab_no_replidentity_index(c1 int)");
82-
$node_subscriber->safe_psql('postgres', "CREATE INDEX idx_no_replidentity_index ON tab_no_replidentity_index(c1)");
84+
$node_subscriber->safe_psql('postgres',
85+
"CREATE TABLE tab_no_replidentity_index(c1 int)");
86+
$node_subscriber->safe_psql('postgres',
87+
"CREATE INDEX idx_no_replidentity_index ON tab_no_replidentity_index(c1)"
88+
);
8389

8490
# Setup logical replication
8591
my $publisher_connstr = $node_publisher->connstr . ' dbname=postgres';
@@ -137,7 +143,8 @@
137143
"DELETE FROM tab_include WHERE a > 20");
138144
$node_publisher->safe_psql('postgres', "UPDATE tab_include SET a = -a");
139145

140-
$node_publisher->safe_psql('postgres', "INSERT INTO tab_no_replidentity_index VALUES(1)");
146+
$node_publisher->safe_psql('postgres',
147+
"INSERT INTO tab_no_replidentity_index VALUES(1)");
141148

142149
$node_publisher->wait_for_catchup('tap_sub');
143150

@@ -162,8 +169,10 @@
162169
is($result, qq(20|-20|-1),
163170
'check replicated changes with primary key index with included columns');
164171

165-
is($node_subscriber->safe_psql('postgres', q(SELECT c1 FROM tab_no_replidentity_index)),
166-
1, "value replicated to subscriber without replica identity index");
172+
is( $node_subscriber->safe_psql(
173+
'postgres', q(SELECT c1 FROM tab_no_replidentity_index)),
174+
1,
175+
"value replicated to subscriber without replica identity index");
167176

168177
# insert some duplicate rows
169178
$node_publisher->safe_psql('postgres',

src/test/subscription/t/010_truncate.pl

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,9 @@
197197
# test that truncate works for logical replication when there are multiple
198198
# subscriptions for a single table
199199

200-
$node_publisher->safe_psql('postgres',
201-
"CREATE TABLE tab5 (a int)");
200+
$node_publisher->safe_psql('postgres', "CREATE TABLE tab5 (a int)");
202201

203-
$node_subscriber->safe_psql('postgres',
204-
"CREATE TABLE tab5 (a int)");
202+
$node_subscriber->safe_psql('postgres', "CREATE TABLE tab5 (a int)");
205203

206204
$node_publisher->safe_psql('postgres',
207205
"CREATE PUBLICATION pub5 FOR TABLE tab5");
@@ -235,8 +233,7 @@
235233

236234
$result = $node_subscriber->safe_psql('postgres',
237235
"SELECT count(*), min(a), max(a) FROM tab5");
238-
is($result, qq(0||),
239-
'truncate replicated for multiple subscriptions');
236+
is($result, qq(0||), 'truncate replicated for multiple subscriptions');
240237

241238
# check deadlocks
242239
$result = $node_subscriber->safe_psql('postgres',

src/test/subscription/t/013_partition.pl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,8 @@ BEGIN
673673
# check that the map to convert tuples from leaf partition to the root
674674
# table is correctly rebuilt when a new column is added
675675
$node_publisher->safe_psql('postgres',
676-
"ALTER TABLE tab2 DROP b, ADD COLUMN c text DEFAULT 'pub_tab2', ADD b text");
676+
"ALTER TABLE tab2 DROP b, ADD COLUMN c text DEFAULT 'pub_tab2', ADD b text"
677+
);
677678
$node_publisher->safe_psql('postgres',
678679
"INSERT INTO tab2 (a, b) VALUES (1, 'xxx'), (3, 'yyy'), (5, 'zzz')");
679680
$node_publisher->safe_psql('postgres',

0 commit comments

Comments
 (0)