1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-05 07:21:24 +03:00

Post-feature-freeze pgindent run.

Discussion: https://postgr.es/m/15719.1523984266@sss.pgh.pa.us
This commit is contained in:
Tom Lane
2018-04-26 14:47:16 -04:00
parent f83bf385c1
commit bdf46af748
167 changed files with 1174 additions and 1061 deletions

View File

@ -942,7 +942,7 @@ AlterObjectOwner_internal(Relation rel, Oid objectId, Oid new_ownerId)
/* Superusers can bypass permission checks */
if (!superuser())
{
ObjectType objtype = get_object_type(classId, objectId);
ObjectType objtype = get_object_type(classId, objectId);
/* must be owner */
if (!has_privs_of_role(GetUserId(), old_ownerId))

View File

@ -1539,8 +1539,8 @@ finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
frozenXid, cutoffMulti, mapped_tables);
/*
* If it's a system catalog, queue a sinval message to flush all
* catcaches on the catalog when we reach CommandCounterIncrement.
* If it's a system catalog, queue a sinval message to flush all catcaches
* on the catalog when we reach CommandCounterIncrement.
*/
if (is_system_catalog)
CacheInvalidateCatalog(OIDOldHeap);

View File

@ -2783,7 +2783,7 @@ CopyFrom(CopyState cstate)
slot,
NULL);
if (slot == NULL) /* "do nothing" */
if (slot == NULL) /* "do nothing" */
goto next_tuple;
/* FDW might have changed tuple */

View File

@ -2184,7 +2184,7 @@ pg_event_trigger_ddl_commands(PG_FUNCTION_ARGS)
"GRANT" : "REVOKE");
/* object_type */
values[i++] = CStringGetTextDatum(stringify_grant_objtype(
cmd->d.grant.istmt->objtype));
cmd->d.grant.istmt->objtype));
/* schema */
nulls[i++] = true;
/* identity */
@ -2244,7 +2244,7 @@ stringify_grant_objtype(ObjectType objtype)
return "TABLESPACE";
case OBJECT_TYPE:
return "TYPE";
/* these currently aren't used */
/* these currently aren't used */
case OBJECT_ACCESS_METHOD:
case OBJECT_AGGREGATE:
case OBJECT_AMOP:
@ -2326,7 +2326,7 @@ stringify_adefprivs_objtype(ObjectType objtype)
return "TABLESPACES";
case OBJECT_TYPE:
return "TYPES";
/* these currently aren't used */
/* these currently aren't used */
case OBJECT_ACCESS_METHOD:
case OBJECT_AGGREGATE:
case OBJECT_AMOP:

View File

@ -305,7 +305,7 @@ interpret_function_parameter_list(ParseState *pstate,
{
if (objtype == OBJECT_PROCEDURE)
*requiredResultType = RECORDOID;
else if (outCount == 0) /* save first output param's type */
else if (outCount == 0) /* save first output param's type */
*requiredResultType = toid;
outCount++;
}

View File

@ -326,7 +326,7 @@ DefineIndex(Oid relationId,
IndexStmt *stmt,
Oid indexRelationId,
Oid parentIndexId,
Oid parentConstraintId,
Oid parentConstraintId,
bool is_alter_table,
bool check_rights,
bool check_not_in_use,
@ -381,11 +381,11 @@ DefineIndex(Oid relationId,
/*
* Calculate the new list of index columns including both key columns and
* INCLUDE columns. Later we can determine which of these are key columns,
* and which are just part of the INCLUDE list by checking the list
* position. A list item in a position less than ii_NumIndexKeyAttrs is
* part of the key columns, and anything equal to and over is part of the
* INCLUDE columns.
* INCLUDE columns. Later we can determine which of these are key
* columns, and which are just part of the INCLUDE list by checking the
* list position. A list item in a position less than ii_NumIndexKeyAttrs
* is part of the key columns, and anything equal to and over is part of
* the INCLUDE columns.
*/
allIndexParams = list_concat(list_copy(stmt->indexParams),
list_copy(stmt->indexIncludingParams));
@ -431,6 +431,7 @@ DefineIndex(Oid relationId,
/* OK */
break;
case RELKIND_FOREIGN_TABLE:
/*
* Custom error message for FOREIGN TABLE since the term is close
* to a regular table and can confuse the user.
@ -691,13 +692,13 @@ DefineIndex(Oid relationId,
* partition-local index can enforce global uniqueness iff the PK
* value completely determines the partition that a row is in.
*
* Thus, verify that all the columns in the partition key appear
* in the unique key definition.
* Thus, verify that all the columns in the partition key appear in
* the unique key definition.
*/
for (i = 0; i < key->partnatts; i++)
{
bool found = false;
int j;
bool found = false;
int j;
const char *constraint_type;
if (stmt->primary)
@ -722,7 +723,7 @@ DefineIndex(Oid relationId,
errmsg("unsupported %s constraint with partition key definition",
constraint_type),
errdetail("%s constraints cannot be used when partition keys include expressions.",
constraint_type)));
constraint_type)));
for (j = 0; j < indexInfo->ii_NumIndexAttrs; j++)
{
@ -820,8 +821,8 @@ DefineIndex(Oid relationId,
/*
* Make the catalog entries for the index, including constraints. This
* step also actually builds the index, except if caller requested not to
* or in concurrent mode, in which case it'll be done later, or
* doing a partitioned index (because those don't have storage).
* or in concurrent mode, in which case it'll be done later, or doing a
* partitioned index (because those don't have storage).
*/
flags = constr_flags = 0;
if (stmt->isconstraint)
@ -871,8 +872,8 @@ DefineIndex(Oid relationId,
if (partitioned)
{
/*
* Unless caller specified to skip this step (via ONLY), process
* each partition to make sure they all contain a corresponding index.
* Unless caller specified to skip this step (via ONLY), process each
* partition to make sure they all contain a corresponding index.
*
* If we're called internally (no stmt->relation), recurse always.
*/
@ -904,13 +905,13 @@ DefineIndex(Oid relationId,
*/
for (i = 0; i < nparts; i++)
{
Oid childRelid = part_oids[i];
Relation childrel;
List *childidxs;
ListCell *cell;
Oid childRelid = part_oids[i];
Relation childrel;
List *childidxs;
ListCell *cell;
AttrNumber *attmap;
bool found = false;
int maplen;
bool found = false;
int maplen;
childrel = heap_open(childRelid, lockmode);
childidxs = RelationGetIndexList(childrel);
@ -940,7 +941,7 @@ DefineIndex(Oid relationId,
opfamOids,
attmap, maplen))
{
Oid cldConstrOid = InvalidOid;
Oid cldConstrOid = InvalidOid;
/*
* Found a match.
@ -1002,7 +1003,7 @@ DefineIndex(Oid relationId,
childStmt->idxname = NULL;
childStmt->relationId = childRelid;
DefineIndex(childRelid, childStmt,
InvalidOid, /* no predefined OID */
InvalidOid, /* no predefined OID */
indexRelationId, /* this is our child */
createdConstraintId,
is_alter_table, check_rights, check_not_in_use,
@ -1014,9 +1015,8 @@ DefineIndex(Oid relationId,
/*
* The pg_index row we inserted for this index was marked
* indisvalid=true. But if we attached an existing index that
* is invalid, this is incorrect, so update our row to
* invalid too.
* indisvalid=true. But if we attached an existing index that is
* invalid, this is incorrect, so update our row to invalid too.
*/
if (invalidate_parent)
{
@ -1479,7 +1479,7 @@ ComputeIndexAttrs(IndexInfo *indexInfo,
}
else
{
indexInfo->ii_IndexAttrNumbers[attn] = 0; /* marks expression */
indexInfo->ii_IndexAttrNumbers[attn] = 0; /* marks expression */
indexInfo->ii_Expressions = lappend(indexInfo->ii_Expressions,
expr);
@ -1505,7 +1505,8 @@ ComputeIndexAttrs(IndexInfo *indexInfo,
typeOidP[attn] = atttype;
/*
* Included columns have no collation, no opclass and no ordering options.
* Included columns have no collation, no opclass and no ordering
* options.
*/
if (attn >= nkeycols)
{
@ -2465,8 +2466,8 @@ void
IndexSetParentIndex(Relation partitionIdx, Oid parentOid)
{
Relation pg_inherits;
ScanKeyData key[2];
SysScanDesc scan;
ScanKeyData key[2];
SysScanDesc scan;
Oid partRelid = RelationGetRelid(partitionIdx);
HeapTuple tuple;
bool fix_dependencies;
@ -2496,15 +2497,15 @@ IndexSetParentIndex(Relation partitionIdx, Oid parentOid)
if (parentOid == InvalidOid)
{
/*
* No pg_inherits row, and no parent wanted: nothing to do in
* this case.
* No pg_inherits row, and no parent wanted: nothing to do in this
* case.
*/
fix_dependencies = false;
}
else
{
Datum values[Natts_pg_inherits];
bool isnull[Natts_pg_inherits];
Datum values[Natts_pg_inherits];
bool isnull[Natts_pg_inherits];
/*
* No pg_inherits row exists, and we want a parent for this index,
@ -2525,7 +2526,7 @@ IndexSetParentIndex(Relation partitionIdx, Oid parentOid)
}
else
{
Form_pg_inherits inhForm = (Form_pg_inherits) GETSTRUCT(tuple);
Form_pg_inherits inhForm = (Form_pg_inherits) GETSTRUCT(tuple);
if (parentOid == InvalidOid)
{
@ -2572,14 +2573,14 @@ IndexSetParentIndex(Relation partitionIdx, Oid parentOid)
if (OidIsValid(parentOid))
{
ObjectAddress parentIdx;
ObjectAddress parentIdx;
ObjectAddressSet(parentIdx, RelationRelationId, parentOid);
recordDependencyOn(&partIdx, &parentIdx, DEPENDENCY_INTERNAL_AUTO);
}
else
{
ObjectAddress partitionTbl;
ObjectAddress partitionTbl;
ObjectAddressSet(partitionTbl, RelationRelationId,
partitionIdx->rd_index->indrelid);

View File

@ -181,7 +181,7 @@ typedef struct
bool nowait; /* no wait mode */
Oid viewowner; /* view owner for checking the privilege */
Oid viewoid; /* OID of the view to be locked */
List *ancestor_views; /* OIDs of ancestor views */
List *ancestor_views; /* OIDs of ancestor views */
} LockViewRecurse_context;
static bool

View File

@ -215,7 +215,7 @@ RelationBuildRowSecurity(Relation relation)
HeapTuple tuple;
MemoryContextCopyAndSetIdentifier(rscxt,
RelationGetRelationName(relation));
RelationGetRelationName(relation));
rsdesc = MemoryContextAllocZero(rscxt, sizeof(RowSecurityDesc));
rsdesc->rscxt = rscxt;

View File

@ -450,9 +450,9 @@ PersistHoldablePortal(Portal portal)
PopActiveSnapshot();
/*
* We can now release any subsidiary memory of the portal's context;
* we'll never use it again. The executor already dropped its context,
* but this will clean up anything that glommed onto the portal's context via
* We can now release any subsidiary memory of the portal's context; we'll
* never use it again. The executor already dropped its context, but this
* will clean up anything that glommed onto the portal's context via
* PortalContext.
*/
MemoryContextDeleteChildren(portal->portalContext);

View File

@ -133,7 +133,8 @@ CreateStatistics(CreateStatsStmt *stmt)
* If the node has a name, split it up and determine creation namespace.
* If not (a possibility not considered by the grammar, but one which can
* occur via the "CREATE TABLE ... (LIKE)" command), then we put the
* object in the same namespace as the relation, and cons up a name for it.
* object in the same namespace as the relation, and cons up a name for
* it.
*/
if (stmt->defnames)
namespaceId = QualifiedNameGetCreationNamespace(stmt->defnames,
@ -462,7 +463,7 @@ ChooseExtendedStatisticName(const char *name1, const char *name2,
for (;;)
{
Oid existingstats;
Oid existingstats;
stxname = makeObjectName(name1, name2, modlabel);
@ -500,7 +501,7 @@ ChooseExtendedStatisticNameAddition(List *exprs)
buf[0] = '\0';
foreach(lc, exprs)
{
ColumnRef *cref = (ColumnRef *) lfirst(lc);
ColumnRef *cref = (ColumnRef *) lfirst(lc);
const char *name;
/* It should be one of these, but just skip if it happens not to be */

View File

@ -1634,7 +1634,8 @@ ExecuteTruncateGuts(List *explicit_rels, List *relids, List *relids_logged,
}
/*
* Write a WAL record to allow this set of actions to be logically decoded.
* Write a WAL record to allow this set of actions to be logically
* decoded.
*
* Assemble an array of relids so we can write a single WAL record for the
* whole action.
@ -1648,7 +1649,7 @@ ExecuteTruncateGuts(List *explicit_rels, List *relids, List *relids_logged,
Assert(XLogLogicalInfoActive());
logrelids = palloc(list_length(relids_logged) * sizeof(Oid));
foreach (cell, relids_logged)
foreach(cell, relids_logged)
logrelids[i++] = lfirst_oid(cell);
xlrec.dbId = MyDatabaseId;
@ -5560,8 +5561,8 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel,
CommandCounterIncrement();
/*
* Did the request for a missing value work? If not we'll have to do
* a rewrite
* Did the request for a missing value work? If not we'll have to do a
* rewrite
*/
if (!rawEnt->missingMode)
tab->rewrite |= AT_REWRITE_DEFAULT_VAL;
@ -7664,9 +7665,9 @@ ATAddForeignKeyConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel,
ObjectAddressSet(address, ConstraintRelationId, constrOid);
/*
* Create the triggers that will enforce the constraint. We only want
* the action triggers to appear for the parent partitioned relation,
* even though the constraints also exist below.
* Create the triggers that will enforce the constraint. We only want the
* action triggers to appear for the parent partitioned relation, even
* though the constraints also exist below.
*/
createForeignKeyTriggers(rel, RelationGetRelid(pkrel), fkconstraint,
constrOid, indexOid, !recursing);
@ -8793,8 +8794,8 @@ createForeignKeyTriggers(Relation rel, Oid refRelOid, Constraint *fkconstraint,
indexOid);
/*
* For the referencing side, create the check triggers. We only need these
* on the partitions.
* For the referencing side, create the check triggers. We only need
* these on the partitions.
*/
if (rel->rd_rel->relkind != RELKIND_PARTITIONED_TABLE)
createForeignKeyCheckTriggers(RelationGetRelid(rel), refRelOid,
@ -13974,8 +13975,9 @@ QueuePartitionConstraintValidation(List **wqueue, Relation scanrel,
}
/*
* Constraints proved insufficient. For plain relations, queue a validation
* item now; for partitioned tables, recurse to process each partition.
* Constraints proved insufficient. For plain relations, queue a
* validation item now; for partitioned tables, recurse to process each
* partition.
*/
if (scanrel->rd_rel->relkind == RELKIND_RELATION)
{
@ -14300,9 +14302,9 @@ ATExecAttachPartition(List **wqueue, Relation rel, PartitionCmd *cmd)
/*
* If we're attaching a partition other than the default partition and a
* default one exists, then that partition's partition constraint changes,
* so add an entry to the work queue to validate it, too. (We must not
* do this when the partition being attached is the default one; we
* already did it above!)
* so add an entry to the work queue to validate it, too. (We must not do
* this when the partition being attached is the default one; we already
* did it above!)
*/
if (OidIsValid(defaultPartOid))
{
@ -14408,8 +14410,8 @@ AttachPartitionEnsureIndexes(Relation rel, Relation attachrel)
*/
for (i = 0; i < list_length(attachRelIdxs); i++)
{
Oid cldIdxId = RelationGetRelid(attachrelIdxRels[i]);
Oid cldConstrOid = InvalidOid;
Oid cldIdxId = RelationGetRelid(attachrelIdxRels[i]);
Oid cldConstrOid = InvalidOid;
/* does this index have a parent? if so, can't use it */
if (attachrelIdxRels[i]->rd_rel->relispartition)
@ -14693,7 +14695,7 @@ ATExecDetachPartition(Relation rel, RangeVar *name)
continue;
Assert((IndexGetRelation(get_partition_parent(idxid), false) ==
RelationGetRelid(rel)));
RelationGetRelid(rel)));
idx = index_open(idxid, AccessExclusiveLock);
IndexSetParentIndex(idx, InvalidOid);
@ -14722,9 +14724,9 @@ ATExecDetachPartition(Relation rel, RangeVar *name)
*/
struct AttachIndexCallbackState
{
Oid partitionOid;
Oid parentTblOid;
bool lockedParentTbl;
Oid partitionOid;
Oid parentTblOid;
bool lockedParentTbl;
};
static void
@ -14836,7 +14838,8 @@ ATExecAttachPartitionIdx(List **wqueue, Relation parentIdx, RangeVar *name)
cldConstrId = InvalidOid;
/*
* If this partition already has an index attached, refuse the operation.
* If this partition already has an index attached, refuse the
* operation.
*/
refuseDupeIndexAttach(parentIdx, partIdx, partTbl);
@ -14890,8 +14893,8 @@ ATExecAttachPartitionIdx(List **wqueue, Relation parentIdx, RangeVar *name)
errdetail("The index definitions do not match.")));
/*
* If there is a constraint in the parent, make sure there is one
* in the child too.
* If there is a constraint in the parent, make sure there is one in
* the child too.
*/
constraintOid = get_relation_idx_constraint_oid(RelationGetRelid(parentTbl),
RelationGetRelid(parentIdx));
@ -14907,9 +14910,9 @@ ATExecAttachPartitionIdx(List **wqueue, Relation parentIdx, RangeVar *name)
RelationGetRelationName(partIdx),
RelationGetRelationName(parentIdx)),
errdetail("The index \"%s\" belongs to a constraint in table \"%s\" but no constraint exists for index \"%s\".",
RelationGetRelationName(parentIdx),
RelationGetRelationName(parentTbl),
RelationGetRelationName(partIdx))));
RelationGetRelationName(parentIdx),
RelationGetRelationName(parentTbl),
RelationGetRelationName(partIdx))));
}
/* All good -- do it */
@ -14938,10 +14941,10 @@ ATExecAttachPartitionIdx(List **wqueue, Relation parentIdx, RangeVar *name)
static void
refuseDupeIndexAttach(Relation parentIdx, Relation partIdx, Relation partitionTbl)
{
Relation pg_inherits;
ScanKeyData key;
HeapTuple tuple;
SysScanDesc scan;
Relation pg_inherits;
ScanKeyData key;
HeapTuple tuple;
SysScanDesc scan;
pg_inherits = heap_open(InheritsRelationId, AccessShareLock);
ScanKeyInit(&key, Anum_pg_inherits_inhparent,
@ -14951,7 +14954,7 @@ refuseDupeIndexAttach(Relation parentIdx, Relation partIdx, Relation partitionTb
NULL, 1, &key);
while (HeapTupleIsValid(tuple = systable_getnext(scan)))
{
Form_pg_inherits inhForm;
Form_pg_inherits inhForm;
Oid tab;
inhForm = (Form_pg_inherits) GETSTRUCT(tuple);
@ -14979,12 +14982,12 @@ refuseDupeIndexAttach(Relation parentIdx, Relation partIdx, Relation partitionTb
static void
validatePartitionedIndex(Relation partedIdx, Relation partedTbl)
{
Relation inheritsRel;
SysScanDesc scan;
ScanKeyData key;
int tuples = 0;
HeapTuple inhTup;
bool updated = false;
Relation inheritsRel;
SysScanDesc scan;
ScanKeyData key;
int tuples = 0;
HeapTuple inhTup;
bool updated = false;
Assert(partedIdx->rd_rel->relkind == RELKIND_PARTITIONED_INDEX);
@ -15002,11 +15005,11 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl)
while ((inhTup = systable_getnext(scan)) != NULL)
{
Form_pg_inherits inhForm = (Form_pg_inherits) GETSTRUCT(inhTup);
HeapTuple indTup;
Form_pg_index indexForm;
HeapTuple indTup;
Form_pg_index indexForm;
indTup = SearchSysCache1(INDEXRELID,
ObjectIdGetDatum(inhForm->inhrelid));
ObjectIdGetDatum(inhForm->inhrelid));
if (!indTup)
elog(ERROR, "cache lookup failed for index %u",
inhForm->inhrelid);

View File

@ -5741,8 +5741,9 @@ AfterTriggerSaveEvent(EState *estate, ResultRelInfo *relinfo,
* oldtup should be non-NULL, whereas for UPDATE events normally both
* oldtup and newtup are non-NULL. But for UPDATE events fired for
* capturing transition tuples during UPDATE partition-key row
* movement, oldtup is NULL when the event is for a row being inserted,
* whereas newtup is NULL when the event is for a row being deleted.
* movement, oldtup is NULL when the event is for a row being
* inserted, whereas newtup is NULL when the event is for a row being
* deleted.
*/
Assert(!(event == TRIGGER_EVENT_DELETE && delete_old_table &&
oldtup == NULL));
@ -5769,7 +5770,7 @@ AfterTriggerSaveEvent(EState *estate, ResultRelInfo *relinfo,
}
if (newtup != NULL &&
((event == TRIGGER_EVENT_INSERT && insert_new_table) ||
(event == TRIGGER_EVENT_UPDATE && update_new_table)))
(event == TRIGGER_EVENT_UPDATE && update_new_table)))
{
Tuplestorestate *new_tuplestore;
@ -5791,9 +5792,9 @@ AfterTriggerSaveEvent(EState *estate, ResultRelInfo *relinfo,
/*
* If transition tables are the only reason we're here, return. As
* mentioned above, we can also be here during update tuple routing in
* presence of transition tables, in which case this function is called
* separately for oldtup and newtup, so we expect exactly one of them
* to be NULL.
* presence of transition tables, in which case this function is
* called separately for oldtup and newtup, so we expect exactly one
* of them to be NULL.
*/
if (trigdesc == NULL ||
(event == TRIGGER_EVENT_DELETE && !trigdesc->trig_delete_after_row) ||