Pre-beta2 mechanical code beautification.

Run pgindent and pgperltidy.  It seems we're still some ways
away from all committers doing this automatically.  Now that
we have a buildfarm animal that will whine about poorly-indented
code, we'll try to keep the tree more tidy.

Discussion: https://postgr.es/m/3156045.1687208823@sss.pgh.pa.us
This commit is contained in:
Tom Lane 2023-06-20 09:50:43 -04:00
parent 877bf52cff
commit b334612b8a
11 changed files with 39 additions and 37 deletions

View File

@ -1354,8 +1354,8 @@ ExecGetExtraUpdatedCols(ResultRelInfo *relinfo, EState *estate)
Bitmapset * Bitmapset *
ExecGetAllUpdatedCols(ResultRelInfo *relinfo, EState *estate) ExecGetAllUpdatedCols(ResultRelInfo *relinfo, EState *estate)
{ {
Bitmapset *ret; Bitmapset *ret;
MemoryContext oldcxt; MemoryContext oldcxt;
oldcxt = MemoryContextSwitchTo(GetPerTupleMemoryContext(estate)); oldcxt = MemoryContextSwitchTo(GetPerTupleMemoryContext(estate));

View File

@ -2693,9 +2693,8 @@ load_hba(void)
if (!ok) if (!ok)
{ {
/* /*
* File contained one or more errors, so bail out. * File contained one or more errors, so bail out. MemoryContextDelete
* MemoryContextDelete is enough to clean up everything, including * is enough to clean up everything, including regexes.
* regexes.
*/ */
MemoryContextDelete(hbacxt); MemoryContextDelete(hbacxt);
return false; return false;
@ -3057,9 +3056,8 @@ load_ident(void)
if (!ok) if (!ok)
{ {
/* /*
* File contained one or more errors, so bail out. * File contained one or more errors, so bail out. MemoryContextDelete
* MemoryContextDelete is enough to clean up everything, including * is enough to clean up everything, including regexes.
* regexes.
*/ */
MemoryContextDelete(ident_context); MemoryContextDelete(ident_context);
return false; return false;

View File

@ -1253,7 +1253,7 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos)
WalRcvExecResult *res; WalRcvExecResult *res;
char originname[NAMEDATALEN]; char originname[NAMEDATALEN];
RepOriginId originid; RepOriginId originid;
UserContext ucxt; UserContext ucxt;
bool must_use_password; bool must_use_password;
bool run_as_owner; bool run_as_owner;
@ -1437,8 +1437,8 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos)
} }
/* /*
* Make sure that the copy command runs as the table owner, unless * Make sure that the copy command runs as the table owner, unless the
* the user has opted out of that behaviour. * user has opted out of that behaviour.
*/ */
run_as_owner = MySubscription->runasowner; run_as_owner = MySubscription->runasowner;
if (!run_as_owner) if (!run_as_owner)
@ -1482,7 +1482,7 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos)
res->err))); res->err)));
walrcv_clear_result(res); walrcv_clear_result(res);
if(!run_as_owner) if (!run_as_owner)
RestoreUserContext(&ucxt); RestoreUserContext(&ucxt);
table_close(rel, NoLock); table_close(rel, NoLock);

View File

@ -415,7 +415,7 @@ pg_fsync(int fd)
int int
pg_fsync_no_writethrough(int fd) pg_fsync_no_writethrough(int fd)
{ {
int rc; int rc;
if (!enableFsync) if (!enableFsync)
return 0; return 0;
@ -456,7 +456,7 @@ pg_fsync_writethrough(int fd)
int int
pg_fdatasync(int fd) pg_fdatasync(int fd)
{ {
int rc; int rc;
if (!enableFsync) if (!enableFsync)
return 0; return 0;
@ -500,6 +500,7 @@ pg_flush_data(int fd, off_t offset, off_t nbytes)
return; return;
retry: retry:
/* /*
* sync_file_range(SYNC_FILE_RANGE_WRITE), currently linux specific, * sync_file_range(SYNC_FILE_RANGE_WRITE), currently linux specific,
* tells the OS that writeback for the specified blocks should be * tells the OS that writeback for the specified blocks should be

View File

@ -1197,9 +1197,9 @@ standby_redo(XLogReaderState *record)
/* /*
* The startup process currently has no convenient way to schedule * The startup process currently has no convenient way to schedule
* stats to be reported. XLOG_RUNNING_XACTS records issued at a * stats to be reported. XLOG_RUNNING_XACTS records issued at a
* regular cadence, making this a convenient location to report * regular cadence, making this a convenient location to report stats.
* stats. While these records aren't generated with wal_level=minimal, * While these records aren't generated with wal_level=minimal, stats
* stats also cannot be accessed during WAL replay. * also cannot be accessed during WAL replay.
*/ */
pgstat_report_stat(true); pgstat_report_stat(true);
} }

View File

@ -564,10 +564,10 @@ mdzeroextend(SMgrRelation reln, ForkNumber forknum,
Assert(segstartblock + numblocks <= RELSEG_SIZE); Assert(segstartblock + numblocks <= RELSEG_SIZE);
/* /*
* If available and useful, use posix_fallocate() (via FileFallocate()) * If available and useful, use posix_fallocate() (via
* to extend the relation. That's often more efficient than using * FileFallocate()) to extend the relation. That's often more
* write(), as it commonly won't cause the kernel to allocate page * efficient than using write(), as it commonly won't cause the kernel
* cache space for the extended pages. * to allocate page cache space for the extended pages.
* *
* However, we don't use FileFallocate() for small extensions, as it * However, we don't use FileFallocate() for small extensions, as it
* defeats delayed allocation on some filesystems. Not clear where * defeats delayed allocation on some filesystems. Not clear where

View File

@ -601,7 +601,7 @@ pg_stat_get_activity(PG_FUNCTION_ARGS)
values[26] = CStringGetTextDatum(beentry->st_gssstatus->gss_princ); values[26] = CStringGetTextDatum(beentry->st_gssstatus->gss_princ);
values[27] = BoolGetDatum(beentry->st_gssstatus->gss_enc); /* GSS Encryption in use */ values[27] = BoolGetDatum(beentry->st_gssstatus->gss_enc); /* GSS Encryption in use */
values[28] = BoolGetDatum(beentry->st_gssstatus->gss_delegation); /* GSS credentials values[28] = BoolGetDatum(beentry->st_gssstatus->gss_delegation); /* GSS credentials
* delegated */ * delegated */
} }
else else
{ {

View File

@ -113,10 +113,12 @@ if ($ENV{with_icu} eq 'yes')
command_like( command_like(
[ [
'initdb', '--no-sync', '-A', 'trust', 'initdb', '--no-sync',
'-A', 'trust',
'--locale-provider=icu', '--locale=und', '--locale-provider=icu', '--locale=und',
'--lc-collate=C', '--lc-ctype=C', '--lc-messages=C', '--lc-collate=C', '--lc-ctype=C',
'--lc-numeric=C', '--lc-monetary=C', '--lc-time=C', '--lc-messages=C', '--lc-numeric=C',
'--lc-monetary=C', '--lc-time=C',
"$tempdir/data4" "$tempdir/data4"
], ],
qr/^\s+ICU locale:\s+und\n/ms, qr/^\s+ICU locale:\s+und\n/ms,

View File

@ -89,12 +89,14 @@ if ($ENV{with_icu} eq 'yes')
$node2->command_ok( $node2->command_ok(
[ [
'createdb', '-T', 'template0', '--locale-provider', 'icu', 'createdb', '-T',
'--locale', 'en', '--lc-collate', 'C', '--lc-ctype', 'C', 'template0', '--locale-provider',
'foobar57' 'icu', '--locale',
'en', '--lc-collate',
'C', '--lc-ctype',
'C', 'foobar57'
], ],
'create database with locale as ICU locale' 'create database with locale as ICU locale');
);
} }
else else
{ {

View File

@ -77,7 +77,7 @@ typedef struct PgBackendGSSStatus
char gss_princ[NAMEDATALEN]; /* GSSAPI Principal used to auth */ char gss_princ[NAMEDATALEN]; /* GSSAPI Principal used to auth */
bool gss_auth; /* If GSSAPI authentication was used */ bool gss_auth; /* If GSSAPI authentication was used */
bool gss_enc; /* If encryption is being used */ bool gss_enc; /* If encryption is being used */
bool gss_delegation; /* If credentials delegated */ bool gss_delegation; /* If credentials delegated */
} PgBackendGSSStatus; } PgBackendGSSStatus;

View File

@ -196,7 +196,7 @@ expect_replication("alice.unpartitioned", 3, 7, 13,
# Remove the subscrition and truncate the table for the initial data sync # Remove the subscrition and truncate the table for the initial data sync
# tests. # tests.
$node_subscriber->safe_psql( $node_subscriber->safe_psql(
'postgres', qq( 'postgres', qq(
DROP SUBSCRIPTION admin_sub; DROP SUBSCRIPTION admin_sub;
TRUNCATE alice.unpartitioned; TRUNCATE alice.unpartitioned;
)); ));
@ -204,7 +204,7 @@ TRUNCATE alice.unpartitioned;
# Create a new subscription "admin_sub" owned by regress_admin2. It's # Create a new subscription "admin_sub" owned by regress_admin2. It's
# disabled so that we revoke superuser privilege after creation. # disabled so that we revoke superuser privilege after creation.
$node_subscriber->safe_psql( $node_subscriber->safe_psql(
'postgres', qq( 'postgres', qq(
SET SESSION AUTHORIZATION regress_admin2; SET SESSION AUTHORIZATION regress_admin2;
CREATE SUBSCRIPTION admin_sub CONNECTION '$publisher_connstr' PUBLICATION alice CREATE SUBSCRIPTION admin_sub CONNECTION '$publisher_connstr' PUBLICATION alice
WITH (run_as_owner = false, password_required = false, copy_data = true, enabled = false); WITH (run_as_owner = false, password_required = false, copy_data = true, enabled = false);
@ -214,16 +214,15 @@ WITH (run_as_owner = false, password_required = false, copy_data = true, enabled
# ability to SET ROLE. Then enable the subscription "admin_sub". # ability to SET ROLE. Then enable the subscription "admin_sub".
revoke_superuser("regress_admin2"); revoke_superuser("regress_admin2");
$node_subscriber->safe_psql( $node_subscriber->safe_psql(
'postgres', qq( 'postgres', qq(
GRANT regress_alice TO regress_admin2 WITH INHERIT FALSE, SET TRUE; GRANT regress_alice TO regress_admin2 WITH INHERIT FALSE, SET TRUE;
ALTER SUBSCRIPTION admin_sub ENABLE; ALTER SUBSCRIPTION admin_sub ENABLE;
)); ));
# Because the initial data sync is working as the table owner, all # Because the initial data sync is working as the table owner, all
# data should be copied. # data should be copied.
$node_subscriber->wait_for_subscription_sync($node_publisher, $node_subscriber->wait_for_subscription_sync($node_publisher, 'admin_sub');
'admin_sub');
expect_replication("alice.unpartitioned", 3, 7, 13, expect_replication("alice.unpartitioned", 3, 7, 13,
"table owner can do the initial data copy"); "table owner can do the initial data copy");
done_testing(); done_testing();