1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-08 11:42:09 +03:00

Initial pgindent run for v12.

This is still using the 2.0 version of pg_bsd_indent.
I thought it would be good to commit this separately,
so as to document the differences between 2.0 and 2.1 behavior.

Discussion: https://postgr.es/m/16296.1558103386@sss.pgh.pa.us
This commit is contained in:
Tom Lane
2019-05-22 12:55:34 -04:00
parent 66a4bad83a
commit be76af171c
221 changed files with 1433 additions and 1302 deletions

View File

@ -61,7 +61,7 @@ CreateAccessMethod(CreateAmStmt *stmt)
errhint("Must be superuser to create an access method.")));
/* Check if name is used */
amoid = GetSysCacheOid1(AMNAME, Anum_pg_am_oid,
amoid = GetSysCacheOid1(AMNAME, Anum_pg_am_oid,
CStringGetDatum(stmt->amname));
if (OidIsValid(amoid))
{

View File

@ -70,8 +70,8 @@ typedef struct
static void rebuild_relation(Relation OldHeap, Oid indexOid, bool verbose);
static void copy_table_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex,
bool verbose, bool *pSwapToastByContent,
TransactionId *pFreezeXid, MultiXactId *pCutoffMulti);
bool verbose, bool *pSwapToastByContent,
TransactionId *pFreezeXid, MultiXactId *pCutoffMulti);
static List *get_tables_to_cluster(MemoryContext cluster_context);
@ -614,7 +614,7 @@ rebuild_relation(Relation OldHeap, Oid indexOid, bool verbose)
/* Copy the heap data into the new table in the desired order */
copy_table_data(OIDNewHeap, tableOid, indexOid, verbose,
&swap_toast_by_content, &frozenXid, &cutoffMulti);
&swap_toast_by_content, &frozenXid, &cutoffMulti);
/*
* Swap the physical files of the target and transient tables, then

View File

@ -83,7 +83,7 @@ unique_key_recheck(PG_FUNCTION_ARGS)
(errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED),
errmsg("function \"%s\" must be fired for INSERT or UPDATE",
funcname)));
ItemPointerSetInvalid(&checktid); /* keep compiler quiet */
ItemPointerSetInvalid(&checktid); /* keep compiler quiet */
}
slot = table_slot_create(trigdata->tg_relation, NULL);
@ -109,7 +109,7 @@ unique_key_recheck(PG_FUNCTION_ARGS)
tmptid = checktid;
{
IndexFetchTableData *scan = table_index_fetch_begin(trigdata->tg_relation);
bool call_again = false;
bool call_again = false;
if (!table_index_fetch_tuple(scan, &tmptid, SnapshotSelf, slot,
&call_again, NULL))

View File

@ -2033,7 +2033,7 @@ get_database_oid(const char *dbname, bool missing_ok)
/* We assume that there can be at most one matching tuple */
if (HeapTupleIsValid(dbtuple))
oid = ((Form_pg_database)GETSTRUCT(dbtuple))->oid;
oid = ((Form_pg_database) GETSTRUCT(dbtuple))->oid;
else
oid = InvalidOid;

View File

@ -606,7 +606,7 @@ ExplainOnePlan(PlannedStmt *plannedstmt, IntoClause *into, ExplainState *es,
static void
ExplainPrintSettings(ExplainState *es)
{
int num;
int num;
struct config_generic **gucs;
/* bail out if information about settings not requested */
@ -622,13 +622,13 @@ ExplainPrintSettings(ExplainState *es)
if (es->format != EXPLAIN_FORMAT_TEXT)
{
int i;
int i;
ExplainOpenGroup("Settings", "Settings", true, es);
for (i = 0; i < num; i++)
{
char *setting;
char *setting;
struct config_generic *conf = gucs[i];
setting = GetConfigOptionByName(conf->name, NULL, true);
@ -640,14 +640,14 @@ ExplainPrintSettings(ExplainState *es)
}
else
{
int i;
StringInfoData str;
int i;
StringInfoData str;
initStringInfo(&str);
for (i = 0; i < num; i++)
{
char *setting;
char *setting;
struct config_generic *conf = gucs[i];
if (i > 0)
@ -705,8 +705,8 @@ ExplainPrintPlan(ExplainState *es, QueryDesc *queryDesc)
ExplainNode(ps, NIL, NULL, NULL, es);
/*
* If requested, include information about GUC parameters with values
* that don't match the built-in defaults.
* If requested, include information about GUC parameters with values that
* don't match the built-in defaults.
*/
ExplainPrintSettings(es);
}
@ -1674,7 +1674,7 @@ ExplainNode(PlanState *planstate, List *ancestors,
if (es->costs && es->verbose &&
outerPlanState(planstate)->worker_jit_instrument)
{
PlanState *child = outerPlanState(planstate);
PlanState *child = outerPlanState(planstate);
int n;
SharedJitInstrumentation *w = child->worker_jit_instrument;

View File

@ -903,9 +903,9 @@ execute_extension_script(Oid extensionOid, ExtensionControlFile *control,
t_sql = DirectFunctionCall3Coll(replace_text,
C_COLLATION_OID,
t_sql,
CStringGetTextDatum("@extschema@"),
CStringGetTextDatum(qSchemaName));
t_sql,
CStringGetTextDatum("@extschema@"),
CStringGetTextDatum(qSchemaName));
}
/*
@ -916,9 +916,9 @@ execute_extension_script(Oid extensionOid, ExtensionControlFile *control,
{
t_sql = DirectFunctionCall3Coll(replace_text,
C_COLLATION_OID,
t_sql,
CStringGetTextDatum("MODULE_PATHNAME"),
CStringGetTextDatum(control->module_pathname));
t_sql,
CStringGetTextDatum("MODULE_PATHNAME"),
CStringGetTextDatum(control->module_pathname));
}
/* And now back to C string */

View File

@ -96,8 +96,8 @@ static void update_relispartition(Oid relationId, bool newval);
*/
struct ReindexIndexCallbackState
{
bool concurrent; /* flag from statement */
Oid locked_table_oid; /* tracks previously locked table */
bool concurrent; /* flag from statement */
Oid locked_table_oid; /* tracks previously locked table */
};
/*
@ -396,7 +396,7 @@ WaitForOlderSnapshots(TransactionId limitXmin, bool progress)
{
if (progress)
{
PGPROC *holder = BackendIdGetProc(old_snapshots[i].backendId);
PGPROC *holder = BackendIdGetProc(old_snapshots[i].backendId);
pgstat_progress_update_param(PROGRESS_WAITFOR_CURRENT_PID,
holder->pid);
@ -984,7 +984,7 @@ DefineIndex(Oid relationId,
*/
if (partitioned && stmt->relation && !stmt->relation->inh)
{
PartitionDesc pd = RelationGetPartitionDesc(rel);
PartitionDesc pd = RelationGetPartitionDesc(rel);
if (pd->nparts != 0)
flags |= INDEX_CREATE_INVALID;
@ -3003,7 +3003,7 @@ ReindexRelationConcurrently(Oid relationOid, int options)
/* Get a session-level lock on each table. */
foreach(lc, relationLocks)
{
LockRelId *lockrelid = (LockRelId *) lfirst(lc);
LockRelId *lockrelid = (LockRelId *) lfirst(lc);
LockRelationIdForSession(lockrelid, ShareUpdateExclusiveLock);
}
@ -3112,8 +3112,8 @@ ReindexRelationConcurrently(Oid relationOid, int options)
/*
* The index is now valid in the sense that it contains all currently
* interesting tuples. But since it might not contain tuples deleted just
* before the reference snap was taken, we have to wait out any
* interesting tuples. But since it might not contain tuples deleted
* just before the reference snap was taken, we have to wait out any
* transactions that might have older snapshots.
*/
pgstat_progress_update_param(PROGRESS_CREATEIDX_PHASE,
@ -3250,7 +3250,7 @@ ReindexRelationConcurrently(Oid relationOid, int options)
*/
foreach(lc, relationLocks)
{
LockRelId *lockrelid = (LockRelId *) lfirst(lc);
LockRelId *lockrelid = (LockRelId *) lfirst(lc);
UnlockRelationIdForSession(lockrelid, ShareUpdateExclusiveLock);
}

View File

@ -465,9 +465,9 @@ UpdateStatisticsForTypeChange(Oid statsOid, Oid relationOid, int attnum,
elog(ERROR, "cache lookup failed for statistics object %u", statsOid);
/*
* When none of the defined statistics types contain datum values
* from the table's columns then there's no need to reset the stats.
* Functional dependencies and ndistinct stats should still hold true.
* When none of the defined statistics types contain datum values from the
* table's columns then there's no need to reset the stats. Functional
* dependencies and ndistinct stats should still hold true.
*/
if (!statext_is_kind_built(oldtup, STATS_EXT_MCV))
{

View File

@ -379,7 +379,7 @@ static void ATExecCheckNotNull(AlteredTableInfo *tab, Relation rel,
const char *colName, LOCKMODE lockmode);
static bool NotNullImpliedByRelConstraints(Relation rel, Form_pg_attribute attr);
static bool ConstraintImpliedByRelConstraint(Relation scanrel,
List *partConstraint, List *existedConstraints);
List *partConstraint, List *existedConstraints);
static ObjectAddress ATExecColumnDefault(Relation rel, const char *colName,
Node *newDefault, LOCKMODE lockmode);
static ObjectAddress ATExecAddIdentity(Relation rel, const char *colName,
@ -1099,9 +1099,9 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId,
}
/*
* Now add any newly specified CHECK constraints to the new relation.
* Same as for defaults above, but these need to come after partitioning
* is set up.
* Now add any newly specified CHECK constraints to the new relation. Same
* as for defaults above, but these need to come after partitioning is set
* up.
*/
if (stmt->constraints)
AddRelationNewConstraints(rel, NIL, stmt->constraints,
@ -1401,9 +1401,9 @@ RangeVarCallbackForDropRelation(const RangeVar *rel, Oid relOid, Oid oldRelOid,
*/
if (IsSystemClass(relOid, classform) && relkind == RELKIND_INDEX)
{
HeapTuple locTuple;
Form_pg_index indexform;
bool indisvalid;
HeapTuple locTuple;
Form_pg_index indexform;
bool indisvalid;
locTuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(relOid));
if (!HeapTupleIsValid(locTuple))
@ -1786,6 +1786,7 @@ ExecuteTruncateGuts(List *explicit_rels, List *relids, List *relids_logged,
{
Relation toastrel = relation_open(toast_relid,
AccessExclusiveLock);
RelationSetNewRelfilenode(toastrel,
toastrel->rd_rel->relpersistence);
table_close(toastrel, NoLock);
@ -4336,6 +4337,7 @@ ATExecCmd(List **wqueue, AlteredTableInfo *tab, Relation rel,
/* nothing to do here, oid columns don't exist anymore */
break;
case AT_SetTableSpace: /* SET TABLESPACE */
/*
* Only do this for partitioned tables and indexes, for which this
* is just a catalog change. Other relation types which have
@ -4626,8 +4628,8 @@ ATRewriteTables(AlterTableStmt *parsetree, List **wqueue, LOCKMODE lockmode)
{
/*
* If required, test the current data within the table against new
* constraints generated by ALTER TABLE commands, but don't rebuild
* data.
* constraints generated by ALTER TABLE commands, but don't
* rebuild data.
*/
if (tab->constraints != NIL || tab->verify_new_notnull ||
tab->partition_constraint != NULL)
@ -4798,8 +4800,8 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap, LOCKMODE lockmode)
{
/*
* If we are rebuilding the tuples OR if we added any new but not
* verified NOT NULL constraints, check all not-null constraints.
* This is a bit of overkill but it minimizes risk of bugs, and
* verified NOT NULL constraints, check all not-null constraints. This
* is a bit of overkill but it minimizes risk of bugs, and
* heap_attisnull is a pretty cheap test anyway.
*/
for (i = 0; i < newTupDesc->natts; i++)
@ -4941,8 +4943,8 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap, LOCKMODE lockmode)
{
/*
* If there's no rewrite, old and new table are guaranteed to
* have the same AM, so we can just use the old slot to
* verify new constraints etc.
* have the same AM, so we can just use the old slot to verify
* new constraints etc.
*/
insertslot = oldslot;
}
@ -6209,9 +6211,8 @@ ATExecSetNotNull(AlteredTableInfo *tab, Relation rel,
/*
* Ordinarily phase 3 must ensure that no NULLs exist in columns that
* are set NOT NULL; however, if we can find a constraint which proves
* this then we can skip that. We needn't bother looking if
* we've already found that we must verify some other NOT NULL
* constraint.
* this then we can skip that. We needn't bother looking if we've
* already found that we must verify some other NOT NULL constraint.
*/
if (!tab->verify_new_notnull &&
!NotNullImpliedByRelConstraints(rel, (Form_pg_attribute) GETSTRUCT(tuple)))
@ -10503,7 +10504,7 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel,
*/
if (tab->rewrite)
{
Relation newrel;
Relation newrel;
newrel = table_open(RelationGetRelid(rel), NoLock);
RelationClearMissing(newrel);
@ -10657,8 +10658,8 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel,
{
/*
* Changing the type of a column that is used by a
* generated column is not allowed by SQL standard.
* It might be doable with some thinking and effort.
* generated column is not allowed by SQL standard. It
* might be doable with some thinking and effort.
*/
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
@ -10862,13 +10863,13 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel,
/*
* Here we go --- change the recorded column type and collation. (Note
* heapTup is a copy of the syscache entry, so okay to scribble on.)
* First fix up the missing value if any.
* heapTup is a copy of the syscache entry, so okay to scribble on.) First
* fix up the missing value if any.
*/
if (attTup->atthasmissing)
{
Datum missingval;
bool missingNull;
Datum missingval;
bool missingNull;
/* if rewrite is true the missing value should already be cleared */
Assert(tab->rewrite == 0);
@ -10881,7 +10882,7 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel,
/* if it's a null array there is nothing to do */
if (! missingNull)
if (!missingNull)
{
/*
* Get the datum out of the array and repack it in a new array
@ -10890,12 +10891,12 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel,
* changed, only the array metadata.
*/
int one = 1;
bool isNull;
Datum valuesAtt[Natts_pg_attribute];
bool nullsAtt[Natts_pg_attribute];
bool replacesAtt[Natts_pg_attribute];
HeapTuple newTup;
int one = 1;
bool isNull;
Datum valuesAtt[Natts_pg_attribute];
bool nullsAtt[Natts_pg_attribute];
bool replacesAtt[Natts_pg_attribute];
HeapTuple newTup;
MemSet(valuesAtt, 0, sizeof(valuesAtt));
MemSet(nullsAtt, false, sizeof(nullsAtt));
@ -10910,12 +10911,12 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel,
attTup->attalign,
&isNull);
missingval = PointerGetDatum(
construct_array(&missingval,
1,
targettype,
tform->typlen,
tform->typbyval,
tform->typalign));
construct_array(&missingval,
1,
targettype,
tform->typlen,
tform->typbyval,
tform->typalign));
valuesAtt[Anum_pg_attribute_attmissingval - 1] = missingval;
replacesAtt[Anum_pg_attribute_attmissingval - 1] = true;
@ -12311,16 +12312,16 @@ ATExecSetTableSpaceNoStorage(Relation rel, Oid newTableSpace)
Oid reloid = RelationGetRelid(rel);
/*
* Shouldn't be called on relations having storage; these are processed
* in phase 3.
* Shouldn't be called on relations having storage; these are processed in
* phase 3.
*/
Assert(!RELKIND_HAS_STORAGE(rel->rd_rel->relkind));
/* Can't allow a non-shared relation in pg_global */
if (newTableSpace == GLOBALTABLESPACE_OID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("only shared relations can be placed in pg_global tablespace")));
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("only shared relations can be placed in pg_global tablespace")));
/*
* No work if no change in tablespace.
@ -15044,7 +15045,7 @@ ComputePartitionAttrs(ParseState *pstate, Relation rel, List *partParams, AttrNu
i = -1;
while ((i = bms_next_member(expr_attrs, i)) >= 0)
{
AttrNumber attno = i + FirstLowInvalidHeapAttributeNumber;
AttrNumber attno = i + FirstLowInvalidHeapAttributeNumber;
if (TupleDescAttr(RelationGetDescr(rel), attno - 1)->attgenerated)
ereport(ERROR,
@ -15202,7 +15203,7 @@ PartConstraintImpliedByRelConstraint(Relation scanrel,
bool
ConstraintImpliedByRelConstraint(Relation scanrel, List *testConstraint, List *provenConstraint)
{
List *existConstraint = list_copy(provenConstraint);
List *existConstraint = list_copy(provenConstraint);
TupleConstr *constr = RelationGetDescr(scanrel)->constr;
int num_check,
i;
@ -15240,8 +15241,8 @@ ConstraintImpliedByRelConstraint(Relation scanrel, List *testConstraint, List *p
* not-false and try to prove the same for testConstraint.
*
* Note that predicate_implied_by assumes its first argument is known
* immutable. That should always be true for both NOT NULL and
* partition constraints, so we don't test it here.
* immutable. That should always be true for both NOT NULL and partition
* constraints, so we don't test it here.
*/
return predicate_implied_by(testConstraint, existConstraint, true);
}

View File

@ -1143,9 +1143,9 @@ GetDefaultTablespace(char relpersistence, bool partitioned)
/*
* Allow explicit specification of database's default tablespace in
* default_tablespace without triggering permissions checks. Don't
* allow specifying that when creating a partitioned table, however,
* since the result is confusing.
* default_tablespace without triggering permissions checks. Don't allow
* specifying that when creating a partitioned table, however, since the
* result is confusing.
*/
if (result == MyDatabaseTableSpace)
{

View File

@ -4245,9 +4245,9 @@ AfterTriggerExecute(EState *estate,
case AFTER_TRIGGER_FDW_REUSE:
/*
* Store tuple in the slot so that tg_trigtuple does not
* reference tuplestore memory. (It is formally possible for the
* trigger function to queue trigger events that add to the same
* Store tuple in the slot so that tg_trigtuple does not reference
* tuplestore memory. (It is formally possible for the trigger
* function to queue trigger events that add to the same
* tuplestore, which can push other tuples out of memory.) The
* distinction is academic, because we start with a minimal tuple
* that is stored as a heap tuple, constructed in different memory

View File

@ -88,13 +88,13 @@ void
ExecVacuum(ParseState *pstate, VacuumStmt *vacstmt, bool isTopLevel)
{
VacuumParams params;
bool verbose = false;
bool skip_locked = false;
bool analyze = false;
bool freeze = false;
bool full = false;
bool disable_page_skipping = false;
ListCell *lc;
bool verbose = false;
bool skip_locked = false;
bool analyze = false;
bool freeze = false;
bool full = false;
bool disable_page_skipping = false;
ListCell *lc;
/* Set default value */
params.index_cleanup = VACOPT_TERNARY_DEFAULT;
@ -103,7 +103,7 @@ ExecVacuum(ParseState *pstate, VacuumStmt *vacstmt, bool isTopLevel)
/* Parse options list */
foreach(lc, vacstmt->options)
{
DefElem *opt = (DefElem *) lfirst(lc);
DefElem *opt = (DefElem *) lfirst(lc);
/* Parse common options for VACUUM and ANALYZE */
if (strcmp(opt->defname, "verbose") == 0)
@ -593,8 +593,9 @@ vacuum_open_relation(Oid relid, RangeVar *relation, int options,
/*
* Determine the log level.
*
* For manual VACUUM or ANALYZE, we emit a WARNING to match the log statements
* in the permission checks; otherwise, only log if the caller so requested.
* For manual VACUUM or ANALYZE, we emit a WARNING to match the log
* statements in the permission checks; otherwise, only log if the caller
* so requested.
*/
if (!IsAutoVacuumWorkerProcess())
elevel = WARNING;
@ -1328,9 +1329,9 @@ vac_update_datfrozenxid(void)
}
/*
* Some table AMs might not need per-relation xid / multixid
* horizons. It therefore seems reasonable to allow relfrozenxid and
* relminmxid to not be set (i.e. set to their respective Invalid*Id)
* Some table AMs might not need per-relation xid / multixid horizons.
* It therefore seems reasonable to allow relfrozenxid and relminmxid
* to not be set (i.e. set to their respective Invalid*Id)
* independently. Thus validate and compute horizon for each only if
* set.
*