Skip to content

Commit da256a4

Browse files
committed
Pre-beta mechanical code beautification.
Run pgindent, pgperltidy, and reformat-dat-files. The pgindent part of this is pretty small, consisting mainly of fixing up self-inflicted formatting damage from patches that hadn't bothered to add their new typedefs to typedefs.list. In order to keep it from making anything worse, I manually added a dozen or so typedefs that appeared in the existing typedefs.list but not in the buildfarm's list. Perhaps we should formalize that, or better find a way to get those typedefs into the automatic list. pgperltidy is as opinionated as always, and reformat-dat-files too.
1 parent 3ddbac3 commit da256a4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+971
-691
lines changed

contrib/sepgsql/hooks.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ typedef struct
5050
* command. Elsewhere (including the case of default) NULL.
5151
*/
5252
const char *createdb_dtemplate;
53-
} sepgsql_context_info_t;
53+
} sepgsql_context_info_t;
5454

5555
static sepgsql_context_info_t sepgsql_context_info;
5656

contrib/sepgsql/label.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ typedef struct
6767
{
6868
SubTransactionId subid;
6969
char *label;
70-
} pending_label;
70+
} pending_label;
7171

7272
/*
7373
* sepgsql_get_client_label

contrib/sepgsql/uavc.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ typedef struct
4444
/* true, if tcontext is valid */
4545
char *ncontext; /* temporary scontext on execution of trusted
4646
* procedure, or NULL elsewhere */
47-
} avc_cache;
47+
} avc_cache;
4848

4949
/*
5050
* Declaration of static variables

src/backend/catalog/Catalog.pm

+55-55
Original file line numberDiff line numberDiff line change
@@ -315,72 +315,72 @@ sub ParseData
315315
my $catname = $1;
316316
my $data = [];
317317

318-
# Scan the input file.
319-
while (<$ifd>)
320-
{
321-
my $hash_ref;
318+
# Scan the input file.
319+
while (<$ifd>)
320+
{
321+
my $hash_ref;
322322

323-
if (/{/)
323+
if (/{/)
324+
{
325+
# Capture the hash ref
326+
# NB: Assumes that the next hash ref can't start on the
327+
# same line where the present one ended.
328+
# Not foolproof, but we shouldn't need a full parser,
329+
# since we expect relatively well-behaved input.
330+
331+
# Quick hack to detect when we have a full hash ref to
332+
# parse. We can't just use a regex because of values in
333+
# pg_aggregate and pg_proc like '{0,0}'. This will need
334+
# work if we ever need to allow unbalanced braces within
335+
# a field value.
336+
my $lcnt = tr/{//;
337+
my $rcnt = tr/}//;
338+
339+
if ($lcnt == $rcnt)
324340
{
325-
# Capture the hash ref
326-
# NB: Assumes that the next hash ref can't start on the
327-
# same line where the present one ended.
328-
# Not foolproof, but we shouldn't need a full parser,
329-
# since we expect relatively well-behaved input.
330-
331-
# Quick hack to detect when we have a full hash ref to
332-
# parse. We can't just use a regex because of values in
333-
# pg_aggregate and pg_proc like '{0,0}'. This will need
334-
# work if we ever need to allow unbalanced braces within
335-
# a field value.
336-
my $lcnt = tr/{//;
337-
my $rcnt = tr/}//;
338-
339-
if ($lcnt == $rcnt)
341+
# We're treating the input line as a piece of Perl, so we
342+
# need to use string eval here. Tell perlcritic we know what
343+
# we're doing.
344+
eval "\$hash_ref = $_"; ## no critic (ProhibitStringyEval)
345+
if (!ref $hash_ref)
340346
{
341-
# We're treating the input line as a piece of Perl, so we
342-
# need to use string eval here. Tell perlcritic we know what
343-
# we're doing.
344-
eval "\$hash_ref = $_"; ## no critic (ProhibitStringyEval)
345-
if (!ref $hash_ref)
346-
{
347-
die "$input_file: error parsing line $.:\n$_\n";
348-
}
349-
350-
# Annotate each hash with the source line number.
351-
$hash_ref->{line_number} = $.;
352-
353-
# Expand tuples to their full representation.
354-
AddDefaultValues($hash_ref, $schema, $catname);
347+
die "$input_file: error parsing line $.:\n$_\n";
355348
}
356-
else
357-
{
358-
my $next_line = <$ifd>;
359-
die "$input_file: file ends within Perl hash\n"
360-
if !defined $next_line;
361-
$_ .= $next_line;
362-
redo;
363-
}
364-
}
365349

366-
# If we found a hash reference, keep it, unless it is marked as
367-
# autogenerated; in that case it'd duplicate an entry we'll
368-
# autogenerate below. (This makes it safe for reformat_dat_file.pl
369-
# with --full-tuples to print autogenerated entries, which seems like
370-
# useful behavior for debugging.)
371-
#
372-
# Otherwise, we have a non-data string, which we keep only if
373-
# the caller requested it.
374-
if (defined $hash_ref)
375-
{
376-
push @$data, $hash_ref if !$hash_ref->{autogenerated};
350+
# Annotate each hash with the source line number.
351+
$hash_ref->{line_number} = $.;
352+
353+
# Expand tuples to their full representation.
354+
AddDefaultValues($hash_ref, $schema, $catname);
377355
}
378356
else
379357
{
380-
push @$data, $_ if $preserve_comments;
358+
my $next_line = <$ifd>;
359+
die "$input_file: file ends within Perl hash\n"
360+
if !defined $next_line;
361+
$_ .= $next_line;
362+
redo;
381363
}
382364
}
383365

366+
# If we found a hash reference, keep it, unless it is marked as
367+
# autogenerated; in that case it'd duplicate an entry we'll
368+
# autogenerate below. (This makes it safe for reformat_dat_file.pl
369+
# with --full-tuples to print autogenerated entries, which seems like
370+
# useful behavior for debugging.)
371+
#
372+
# Otherwise, we have a non-data string, which we keep only if
373+
# the caller requested it.
374+
if (defined $hash_ref)
375+
{
376+
push @$data, $hash_ref if !$hash_ref->{autogenerated};
377+
}
378+
else
379+
{
380+
push @$data, $_ if $preserve_comments;
381+
}
382+
}
383+
384384
close $ifd;
385385

386386
# If this is pg_type, auto-generate array types too.

src/bin/pg_amcheck/t/002_nonesuch.pl

+2-5
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,7 @@
302302
));
303303

304304
$node->command_checks_all(
305-
[
306-
'pg_amcheck', '-d', 'regression_invalid'
307-
],
305+
[ 'pg_amcheck', '-d', 'regression_invalid' ],
308306
1,
309307
[qr/^$/],
310308
[
@@ -314,8 +312,7 @@
314312

315313
$node->command_checks_all(
316314
[
317-
'pg_amcheck', '-d', 'postgres',
318-
'-t', 'regression_invalid.public.foo',
315+
'pg_amcheck', '-d', 'postgres', '-t', 'regression_invalid.public.foo',
319316
],
320317
1,
321318
[qr/^$/],

src/bin/pg_basebackup/t/010_pg_basebackup.pl

+10-7
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,9 @@
411411
$tblspc_tars[0] =~ m|/([0-9]*)\.tar$|;
412412
my $tblspcoid = $1;
413413
my $realRepTsDir = "$real_sys_tempdir/tblspc1replica";
414-
$node2->init_from_backup($node, 'tarbackup2', tar_program => $tar,
414+
$node2->init_from_backup(
415+
$node, 'tarbackup2',
416+
tar_program => $tar,
415417
'tablespace_map' => { $tblspcoid => $realRepTsDir });
416418

417419
$node2->start;
@@ -776,10 +778,8 @@
776778
'stream', '-d', "dbname=db1", '-R',
777779
],
778780
'pg_basebackup with dbname and -R runs');
779-
like(
780-
slurp_file("$tempdir/backup_dbname_R/postgresql.auto.conf"),
781-
qr/dbname=db1/m,
782-
'recovery conf file sets dbname');
781+
like(slurp_file("$tempdir/backup_dbname_R/postgresql.auto.conf"),
782+
qr/dbname=db1/m, 'recovery conf file sets dbname');
783783

784784
rmtree("$tempdir/backup_dbname_R");
785785

@@ -976,8 +976,11 @@
976976
$node2->start;
977977

978978
$node2->command_fails_like(
979-
[ @pg_basebackup_defs, '-D', "$tempdir" . '/diff_sysid',
980-
'--incremental', "$backupdir" . '/backup_manifest' ],
979+
[
980+
@pg_basebackup_defs, '-D',
981+
"$tempdir" . '/diff_sysid', '--incremental',
982+
"$backupdir" . '/backup_manifest'
983+
],
981984
qr/manifest system identifier is .*, but database system identifier is/,
982985
"pg_basebackup fails with different database system manifest");
983986

src/bin/pg_basebackup/t/040_pg_createsubscriber.pl

+55-51
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,11 @@
140140
'pg_createsubscriber', '--verbose',
141141
'--dry-run', '--pgdata',
142142
$node_t->data_dir, '--publisher-server',
143-
$node_p->connstr('pg1'),
144-
'--socket-directory', $node_t->host,
145-
'--subscriber-port', $node_t->port,
146-
'--database', 'pg1',
147-
'--database', 'pg2'
143+
$node_p->connstr('pg1'), '--socket-directory',
144+
$node_t->host, '--subscriber-port',
145+
$node_t->port, '--database',
146+
'pg1', '--database',
147+
'pg2'
148148
],
149149
'target server is not in recovery');
150150

@@ -154,11 +154,11 @@
154154
'pg_createsubscriber', '--verbose',
155155
'--dry-run', '--pgdata',
156156
$node_s->data_dir, '--publisher-server',
157-
$node_p->connstr('pg1'),
158-
'--socket-directory', $node_s->host,
159-
'--subscriber-port', $node_s->port,
160-
'--database', 'pg1',
161-
'--database', 'pg2'
157+
$node_p->connstr('pg1'), '--socket-directory',
158+
$node_s->host, '--subscriber-port',
159+
$node_s->port, '--database',
160+
'pg1', '--database',
161+
'pg2'
162162
],
163163
'standby is up and running');
164164

@@ -188,11 +188,11 @@
188188
'pg_createsubscriber', '--verbose',
189189
'--dry-run', '--pgdata',
190190
$node_c->data_dir, '--publisher-server',
191-
$node_s->connstr('pg1'),
192-
'--socket-directory', $node_c->host,
193-
'--subscriber-port', $node_c->port,
194-
'--database', 'pg1',
195-
'--database', 'pg2'
191+
$node_s->connstr('pg1'), '--socket-directory',
192+
$node_c->host, '--subscriber-port',
193+
$node_c->port, '--database',
194+
'pg1', '--database',
195+
'pg2'
196196
],
197197
'primary server is in recovery');
198198

@@ -201,7 +201,8 @@
201201
$node_p->wait_for_replay_catchup($node_s);
202202

203203
# Check some unmet conditions on node P
204-
$node_p->append_conf('postgresql.conf', q{
204+
$node_p->append_conf(
205+
'postgresql.conf', q{
205206
wal_level = replica
206207
max_replication_slots = 1
207208
max_wal_senders = 1
@@ -214,24 +215,26 @@
214215
'pg_createsubscriber', '--verbose',
215216
'--dry-run', '--pgdata',
216217
$node_s->data_dir, '--publisher-server',
217-
$node_p->connstr('pg1'),
218-
'--socket-directory', $node_s->host,
219-
'--subscriber-port', $node_s->port,
220-
'--database', 'pg1',
221-
'--database', 'pg2'
218+
$node_p->connstr('pg1'), '--socket-directory',
219+
$node_s->host, '--subscriber-port',
220+
$node_s->port, '--database',
221+
'pg1', '--database',
222+
'pg2'
222223
],
223224
'primary contains unmet conditions on node P');
224225
# Restore default settings here but only apply it after testing standby. Some
225226
# standby settings should not be a lower setting than on the primary.
226-
$node_p->append_conf('postgresql.conf', q{
227+
$node_p->append_conf(
228+
'postgresql.conf', q{
227229
wal_level = logical
228230
max_replication_slots = 10
229231
max_wal_senders = 10
230232
max_worker_processes = 8
231233
});
232234

233235
# Check some unmet conditions on node S
234-
$node_s->append_conf('postgresql.conf', q{
236+
$node_s->append_conf(
237+
'postgresql.conf', q{
235238
max_replication_slots = 1
236239
max_logical_replication_workers = 1
237240
max_worker_processes = 2
@@ -241,14 +244,15 @@
241244
'pg_createsubscriber', '--verbose',
242245
'--dry-run', '--pgdata',
243246
$node_s->data_dir, '--publisher-server',
244-
$node_p->connstr('pg1'),
245-
'--socket-directory', $node_s->host,
246-
'--subscriber-port', $node_s->port,
247-
'--database', 'pg1',
248-
'--database', 'pg2'
247+
$node_p->connstr('pg1'), '--socket-directory',
248+
$node_s->host, '--subscriber-port',
249+
$node_s->port, '--database',
250+
'pg1', '--database',
251+
'pg2'
249252
],
250253
'standby contains unmet conditions on node S');
251-
$node_s->append_conf('postgresql.conf', q{
254+
$node_s->append_conf(
255+
'postgresql.conf', q{
252256
max_replication_slots = 10
253257
max_logical_replication_workers = 4
254258
max_worker_processes = 8
@@ -262,15 +266,15 @@
262266
'pg_createsubscriber', '--verbose',
263267
'--dry-run', '--pgdata',
264268
$node_s->data_dir, '--publisher-server',
265-
$node_p->connstr('pg1'),
266-
'--socket-directory', $node_s->host,
267-
'--subscriber-port', $node_s->port,
268-
'--publication', 'pub1',
269-
'--publication', 'pub2',
270-
'--subscription', 'sub1',
271-
'--subscription', 'sub2',
272-
'--database', 'pg1',
273-
'--database', 'pg2'
269+
$node_p->connstr('pg1'), '--socket-directory',
270+
$node_s->host, '--subscriber-port',
271+
$node_s->port, '--publication',
272+
'pub1', '--publication',
273+
'pub2', '--subscription',
274+
'sub1', '--subscription',
275+
'sub2', '--database',
276+
'pg1', '--database',
277+
'pg2'
274278
],
275279
'run pg_createsubscriber --dry-run on node S');
276280

@@ -286,10 +290,10 @@
286290
'pg_createsubscriber', '--verbose',
287291
'--dry-run', '--pgdata',
288292
$node_s->data_dir, '--publisher-server',
289-
$node_p->connstr('pg1'),
290-
'--socket-directory', $node_s->host,
291-
'--subscriber-port', $node_s->port,
292-
'--replication-slot', 'replslot1'
293+
$node_p->connstr('pg1'), '--socket-directory',
294+
$node_s->host, '--subscriber-port',
295+
$node_s->port, '--replication-slot',
296+
'replslot1'
293297
],
294298
'run pg_createsubscriber without --databases');
295299

@@ -299,15 +303,15 @@
299303
'pg_createsubscriber', '--verbose',
300304
'--verbose', '--pgdata',
301305
$node_s->data_dir, '--publisher-server',
302-
$node_p->connstr('pg1'),
303-
'--socket-directory', $node_s->host,
304-
'--subscriber-port', $node_s->port,
305-
'--publication', 'pub1',
306-
'--publication', 'Pub2',
307-
'--replication-slot', 'replslot1',
308-
'--replication-slot', 'replslot2',
309-
'--database', 'pg1',
310-
'--database', 'pg2'
306+
$node_p->connstr('pg1'), '--socket-directory',
307+
$node_s->host, '--subscriber-port',
308+
$node_s->port, '--publication',
309+
'pub1', '--publication',
310+
'Pub2', '--replication-slot',
311+
'replslot1', '--replication-slot',
312+
'replslot2', '--database',
313+
'pg1', '--database',
314+
'pg2'
311315
],
312316
'run pg_createsubscriber on node S');
313317

0 commit comments

Comments
 (0)