diff options
Diffstat (limited to 'src/backend/commands')
-rw-r--r-- | src/backend/commands/amcmds.c | 2 | ||||
-rw-r--r-- | src/backend/commands/cluster.c | 6 | ||||
-rw-r--r-- | src/backend/commands/constraint.c | 4 | ||||
-rw-r--r-- | src/backend/commands/dbcommands.c | 2 | ||||
-rw-r--r-- | src/backend/commands/explain.c | 18 | ||||
-rw-r--r-- | src/backend/commands/extension.c | 12 | ||||
-rw-r--r-- | src/backend/commands/indexcmds.c | 16 | ||||
-rw-r--r-- | src/backend/commands/statscmds.c | 6 | ||||
-rw-r--r-- | src/backend/commands/tablecmds.c | 89 | ||||
-rw-r--r-- | src/backend/commands/tablespace.c | 6 | ||||
-rw-r--r-- | src/backend/commands/trigger.c | 6 | ||||
-rw-r--r-- | src/backend/commands/vacuum.c | 27 |
12 files changed, 98 insertions, 96 deletions
diff --git a/src/backend/commands/amcmds.c b/src/backend/commands/amcmds.c index c1603737eb5..c0e40980d5f 100644 --- a/src/backend/commands/amcmds.c +++ b/src/backend/commands/amcmds.c @@ -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)) { diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c index 3ee70560476..cacc023619c 100644 --- a/src/backend/commands/cluster.c +++ b/src/backend/commands/cluster.c @@ -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 diff --git a/src/backend/commands/constraint.c b/src/backend/commands/constraint.c index cd04e4ea81b..806962a686b 100644 --- a/src/backend/commands/constraint.c +++ b/src/backend/commands/constraint.c @@ -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)) diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c index 9707afabd98..5015e5b3b60 100644 --- a/src/backend/commands/dbcommands.c +++ b/src/backend/commands/dbcommands.c @@ -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; diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index a6c6de78f11..039a87c1551 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -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; diff --git a/src/backend/commands/extension.c b/src/backend/commands/extension.c index d4723fced89..300bb1261f7 100644 --- a/src/backend/commands/extension.c +++ b/src/backend/commands/extension.c @@ -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 */ diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c index 7e7c03ef124..62a4c4fb9be 100644 --- a/src/backend/commands/indexcmds.c +++ b/src/backend/commands/indexcmds.c @@ -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); } diff --git a/src/backend/commands/statscmds.c b/src/backend/commands/statscmds.c index a191916d032..95ec352abe6 100644 --- a/src/backend/commands/statscmds.c +++ b/src/backend/commands/statscmds.c @@ -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)) { diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index bfcf9472d7a..7fa8dcce614 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -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); } diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c index 8ec963f1cfb..33df2ec0af3 100644 --- a/src/backend/commands/tablespace.c +++ b/src/backend/commands/tablespace.c @@ -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) { diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c index 2beb3781450..209021a61a9 100644 --- a/src/backend/commands/trigger.c +++ b/src/backend/commands/trigger.c @@ -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 diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index afdd3307acd..d69a73d13ed 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -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. * |