diff options
author | Bruce Momjian <bruce@momjian.us> | 2013-05-29 16:58:43 -0400 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2013-05-29 16:58:43 -0400 |
commit | 9af4159fce6654aa0e081b00d02bca40b978745c (patch) | |
tree | 3aa507fc6cc67ed3d9f6ceec4d65d1e56cc08e1a /src/backend/commands | |
parent | 07ab261ef3a9575a4a2bd3045b222d7b3dee2c46 (diff) | |
download | postgresql-9af4159fce6654aa0e081b00d02bca40b978745c.tar.gz postgresql-9af4159fce6654aa0e081b00d02bca40b978745c.zip |
pgindent run for release 9.3
This is the first run of the Perl-based pgindent script. Also update
pgindent instructions.
Diffstat (limited to 'src/backend/commands')
-rw-r--r-- | src/backend/commands/aggregatecmds.c | 6 | ||||
-rw-r--r-- | src/backend/commands/alter.c | 36 | ||||
-rw-r--r-- | src/backend/commands/async.c | 4 | ||||
-rw-r--r-- | src/backend/commands/cluster.c | 4 | ||||
-rw-r--r-- | src/backend/commands/copy.c | 57 | ||||
-rw-r--r-- | src/backend/commands/createas.c | 4 | ||||
-rw-r--r-- | src/backend/commands/dbcommands.c | 15 | ||||
-rw-r--r-- | src/backend/commands/event_trigger.c | 275 | ||||
-rw-r--r-- | src/backend/commands/explain.c | 4 | ||||
-rw-r--r-- | src/backend/commands/functioncmds.c | 4 | ||||
-rw-r--r-- | src/backend/commands/indexcmds.c | 4 | ||||
-rw-r--r-- | src/backend/commands/matview.c | 12 | ||||
-rw-r--r-- | src/backend/commands/opclasscmds.c | 4 | ||||
-rw-r--r-- | src/backend/commands/operatorcmds.c | 16 | ||||
-rw-r--r-- | src/backend/commands/proclang.c | 4 | ||||
-rw-r--r-- | src/backend/commands/sequence.c | 8 | ||||
-rw-r--r-- | src/backend/commands/tablecmds.c | 50 | ||||
-rw-r--r-- | src/backend/commands/trigger.c | 10 | ||||
-rw-r--r-- | src/backend/commands/typecmds.c | 64 | ||||
-rw-r--r-- | src/backend/commands/user.c | 2 | ||||
-rw-r--r-- | src/backend/commands/vacuum.c | 20 | ||||
-rw-r--r-- | src/backend/commands/vacuumlazy.c | 61 |
22 files changed, 337 insertions, 327 deletions
diff --git a/src/backend/commands/aggregatecmds.c b/src/backend/commands/aggregatecmds.c index d34a102ee61..4a03786210a 100644 --- a/src/backend/commands/aggregatecmds.c +++ b/src/backend/commands/aggregatecmds.c @@ -217,13 +217,13 @@ DefineAggregate(List *name, List *args, bool oldstyle, List *parameters) /* * Most of the argument-checking is done inside of AggregateCreate */ - return AggregateCreate(aggName, /* aggregate name */ + return AggregateCreate(aggName, /* aggregate name */ aggNamespace, /* namespace */ - aggArgTypes, /* input data type(s) */ + aggArgTypes, /* input data type(s) */ numArgs, transfuncName, /* step function name */ finalfuncName, /* final function name */ sortoperatorName, /* sort operator name */ - transTypeId, /* transition data type */ + transTypeId, /* transition data type */ initval); /* initial condition */ } diff --git a/src/backend/commands/alter.c b/src/backend/commands/alter.c index 665b3804d57..178c97949dc 100644 --- a/src/backend/commands/alter.c +++ b/src/backend/commands/alter.c @@ -62,7 +62,7 @@ #include "utils/tqual.h" -static Oid AlterObjectNamespace_internal(Relation rel, Oid objid, Oid nspOid); +static Oid AlterObjectNamespace_internal(Relation rel, Oid objid, Oid nspOid); /* * Raise an error to the effect that an object of the given name is already @@ -71,7 +71,7 @@ static Oid AlterObjectNamespace_internal(Relation rel, Oid objid, Oid nspOid); static void report_name_conflict(Oid classId, const char *name) { - char *msgfmt; + char *msgfmt; switch (classId) { @@ -100,7 +100,7 @@ report_name_conflict(Oid classId, const char *name) static void report_namespace_conflict(Oid classId, const char *name, Oid nspOid) { - char *msgfmt; + char *msgfmt; Assert(OidIsValid(nspOid)); @@ -221,10 +221,10 @@ AlterObjectRename_internal(Relation rel, Oid objectId, const char *new_name) } /* - * Check for duplicate name (more friendly than unique-index failure). - * Since this is just a friendliness check, we can just skip it in cases - * where there isn't suitable support. - */ + * Check for duplicate name (more friendly than unique-index failure). + * Since this is just a friendliness check, we can just skip it in cases + * where there isn't suitable support. + */ if (classId == ProcedureRelationId) { Form_pg_proc proc = (Form_pg_proc) GETSTRUCT(oldtup); @@ -355,9 +355,9 @@ ExecRenameStmt(RenameStmt *stmt) case OBJECT_TSPARSER: case OBJECT_TSTEMPLATE: { - ObjectAddress address; - Relation catalog; - Relation relation; + ObjectAddress address; + Relation catalog; + Relation relation; address = get_object_address(stmt->renameType, stmt->object, stmt->objarg, @@ -377,7 +377,7 @@ ExecRenameStmt(RenameStmt *stmt) default: elog(ERROR, "unrecognized rename stmt type: %d", (int) stmt->renameType); - return InvalidOid; /* keep compiler happy */ + return InvalidOid; /* keep compiler happy */ } } @@ -699,7 +699,7 @@ ExecAlterOwnerStmt(AlterOwnerStmt *stmt) return AlterEventTriggerOwner(strVal(linitial(stmt->object)), newowner); - /* Generic cases */ + /* Generic cases */ case OBJECT_AGGREGATE: case OBJECT_COLLATION: case OBJECT_CONVERSION: @@ -716,7 +716,7 @@ ExecAlterOwnerStmt(AlterOwnerStmt *stmt) Relation catalog; Relation relation; Oid classId; - ObjectAddress address; + ObjectAddress address; address = get_object_address(stmt->objectType, stmt->object, @@ -804,13 +804,13 @@ AlterObjectOwner_internal(Relation rel, Oid objectId, Oid new_ownerId) /* Superusers can bypass permission checks */ if (!superuser()) { - AclObjectKind aclkind = get_object_aclkind(classId); + AclObjectKind aclkind = get_object_aclkind(classId); /* must be owner */ if (!has_privs_of_role(GetUserId(), old_ownerId)) { - char *objname; - char namebuf[NAMEDATALEN]; + char *objname; + char namebuf[NAMEDATALEN]; if (Anum_name != InvalidAttrNumber) { @@ -833,7 +833,7 @@ AlterObjectOwner_internal(Relation rel, Oid objectId, Oid new_ownerId) /* New owner must have CREATE privilege on namespace */ if (OidIsValid(namespaceId)) { - AclResult aclresult; + AclResult aclresult; aclresult = pg_namespace_aclcheck(namespaceId, new_ownerId, ACL_CREATE); @@ -861,7 +861,7 @@ AlterObjectOwner_internal(Relation rel, Oid objectId, Oid new_ownerId) Anum_acl, RelationGetDescr(rel), &isnull); if (!isnull) { - Acl *newAcl; + Acl *newAcl; newAcl = aclnewowner(DatumGetAclP(datum), old_ownerId, new_ownerId); diff --git a/src/backend/commands/async.c b/src/backend/commands/async.c index 9845cf9a4d7..f7ebd1a650d 100644 --- a/src/backend/commands/async.c +++ b/src/backend/commands/async.c @@ -1147,7 +1147,7 @@ asyncQueueUnregister(void) Assert(listenChannels == NIL); /* else caller error */ - if (!amRegisteredListener) /* nothing to do */ + if (!amRegisteredListener) /* nothing to do */ return; LWLockAcquire(AsyncQueueLock, LW_SHARED); @@ -1519,7 +1519,7 @@ AtAbort_Notify(void) /* * If we LISTEN but then roll back the transaction after PreCommit_Notify, * we have registered as a listener but have not made any entry in - * listenChannels. In that case, deregister again. + * listenChannels. In that case, deregister again. */ if (amRegisteredListener && listenChannels == NIL) asyncQueueUnregister(); diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c index 878b6254f54..095d5e42d94 100644 --- a/src/backend/commands/cluster.c +++ b/src/backend/commands/cluster.c @@ -570,7 +570,7 @@ rebuild_relation(Relation OldHeap, Oid indexOid, bool is_system_catalog; bool swap_toast_by_content; TransactionId frozenXid; - MultiXactId frozenMulti; + MultiXactId frozenMulti; /* Mark the correct index as clustered */ if (OidIsValid(indexOid)) @@ -746,7 +746,7 @@ copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex, bool is_system_catalog; TransactionId OldestXmin; TransactionId FreezeXid; - MultiXactId MultiXactFrzLimit; + MultiXactId MultiXactFrzLimit; RewriteState rwstate; bool use_sort; Tuplesortstate *tuplesort; diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c index ba4cf3e942a..31819cce1d8 100644 --- a/src/backend/commands/copy.c +++ b/src/backend/commands/copy.c @@ -126,7 +126,7 @@ typedef struct CopyStateData List *force_notnull; /* list of column names */ bool *force_notnull_flags; /* per-column CSV FNN flags */ bool convert_selectively; /* do selective binary conversion? */ - List *convert_select; /* list of column names (can be NIL) */ + List *convert_select; /* list of column names (can be NIL) */ bool *convert_select_flags; /* per-column CSV/TEXT CS flags */ /* these are just for error messages, see CopyFromErrorCallback */ @@ -183,7 +183,7 @@ typedef struct CopyStateData */ StringInfoData line_buf; bool line_buf_converted; /* converted to server encoding? */ - bool line_buf_valid; /* contains the row being processed? */ + bool line_buf_valid; /* contains the row being processed? */ /* * Finally, raw_buf holds raw data read from the data source (file or @@ -501,9 +501,9 @@ CopySendEndOfRow(CopyState cstate) ClosePipeToProgram(cstate); /* - * If ClosePipeToProgram() didn't throw an error, - * the program terminated normally, but closed the - * pipe first. Restore errno, and throw an error. + * If ClosePipeToProgram() didn't throw an error, the + * program terminated normally, but closed the pipe + * first. Restore errno, and throw an error. */ errno = EPIPE; } @@ -781,7 +781,7 @@ DoCopy(const CopyStmt *stmt, const char *queryString, uint64 *processed) bool is_from = stmt->is_from; bool pipe = (stmt->filename == NULL); Relation rel; - Oid relid; + Oid relid; /* Disallow COPY to/from file or program except to superusers. */ if (!pipe && !superuser()) @@ -789,15 +789,15 @@ DoCopy(const CopyStmt *stmt, const char *queryString, uint64 *processed) if (stmt->is_program) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - errmsg("must be superuser to COPY to or from an external program"), + errmsg("must be superuser to COPY to or from an external program"), errhint("Anyone can COPY to stdout or from stdin. " - "psql's \\copy command also works for anyone."))); + "psql's \\copy command also works for anyone."))); else ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), errmsg("must be superuser to COPY to or from a file"), errhint("Anyone can COPY to stdout or from stdin. " - "psql's \\copy command also works for anyone."))); + "psql's \\copy command also works for anyone."))); } if (stmt->relation) @@ -1022,9 +1022,9 @@ ProcessCopyOptions(CopyState cstate, else if (strcmp(defel->defname, "convert_selectively") == 0) { /* - * Undocumented, not-accessible-from-SQL option: convert only - * the named columns to binary form, storing the rest as NULLs. - * It's allowed for the column list to be NIL. + * Undocumented, not-accessible-from-SQL option: convert only the + * named columns to binary form, storing the rest as NULLs. It's + * allowed for the column list to be NIL. */ if (cstate->convert_selectively) ereport(ERROR, @@ -1403,7 +1403,7 @@ BeginCopy(bool is_from, ereport(ERROR, (errcode(ERRCODE_INVALID_COLUMN_REFERENCE), errmsg_internal("selected column \"%s\" not referenced by COPY", - NameStr(tupDesc->attrs[attnum - 1]->attname)))); + NameStr(tupDesc->attrs[attnum - 1]->attname)))); cstate->convert_select_flags[attnum - 1] = true; } } @@ -1436,7 +1436,7 @@ BeginCopy(bool is_from, static void ClosePipeToProgram(CopyState cstate) { - int pclose_rc; + int pclose_rc; Assert(cstate->is_program); @@ -1482,7 +1482,7 @@ BeginCopyTo(Relation rel, Node *query, const char *queryString, const char *filename, - bool is_program, + bool is_program, List *attnamelist, List *options) { @@ -1546,7 +1546,7 @@ BeginCopyTo(Relation rel, } else { - mode_t oumask; /* Pre-existing umask value */ + mode_t oumask; /* Pre-existing umask value */ struct stat st; /* @@ -1556,7 +1556,7 @@ BeginCopyTo(Relation rel, if (!is_absolute_path(filename)) ereport(ERROR, (errcode(ERRCODE_INVALID_NAME), - errmsg("relative path not allowed for COPY to file"))); + errmsg("relative path not allowed for COPY to file"))); oumask = umask(S_IWGRP | S_IWOTH); cstate->copy_file = AllocateFile(cstate->filename, PG_BINARY_W); @@ -1929,8 +1929,8 @@ CopyFromErrorCallback(void *arg) * Error is relevant to a particular line. * * If line_buf still contains the correct line, and it's already - * transcoded, print it. If it's still in a foreign encoding, - * it's quite likely that the error is precisely a failure to do + * transcoded, print it. If it's still in a foreign encoding, it's + * quite likely that the error is precisely a failure to do * encoding conversion (ie, bad data). We dare not try to convert * it, and at present there's no way to regurgitate it without * conversion. So we have to punt and just report the line number. @@ -2096,23 +2096,22 @@ CopyFrom(CopyState cstate) } /* - * Optimize if new relfilenode was created in this subxact or - * one of its committed children and we won't see those rows later - * as part of an earlier scan or command. This ensures that if this - * subtransaction aborts then the frozen rows won't be visible - * after xact cleanup. Note that the stronger test of exactly - * which subtransaction created it is crucial for correctness - * of this optimisation. + * Optimize if new relfilenode was created in this subxact or one of its + * committed children and we won't see those rows later as part of an + * earlier scan or command. This ensures that if this subtransaction + * aborts then the frozen rows won't be visible after xact cleanup. Note + * that the stronger test of exactly which subtransaction created it is + * crucial for correctness of this optimisation. */ if (cstate->freeze) { if (!ThereAreNoPriorRegisteredSnapshots() || !ThereAreNoReadyPortals()) ereport(ERROR, (ERRCODE_INVALID_TRANSACTION_STATE, - errmsg("cannot perform FREEZE because of prior transaction activity"))); + errmsg("cannot perform FREEZE because of prior transaction activity"))); if (cstate->rel->rd_createSubid != GetCurrentSubTransactionId() && - cstate->rel->rd_newRelfilenodeSubid != GetCurrentSubTransactionId()) + cstate->rel->rd_newRelfilenodeSubid != GetCurrentSubTransactionId()) ereport(ERROR, (ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE, errmsg("cannot perform FREEZE because the table was not created or truncated in the current subtransaction"))); @@ -2427,7 +2426,7 @@ CopyFromInsertBatch(CopyState cstate, EState *estate, CommandId mycid, CopyState BeginCopyFrom(Relation rel, const char *filename, - bool is_program, + bool is_program, List *attnamelist, List *options) { diff --git a/src/backend/commands/createas.c b/src/backend/commands/createas.c index 14973f8e7c4..2bfe5fba877 100644 --- a/src/backend/commands/createas.c +++ b/src/backend/commands/createas.c @@ -173,7 +173,7 @@ ExecCreateTableAs(CreateTableAsStmt *stmt, const char *queryString, int GetIntoRelEFlags(IntoClause *intoClause) { - int flags; + int flags; /* * We need to tell the executor whether it has to produce OIDs or not, @@ -348,7 +348,7 @@ intorel_startup(DestReceiver *self, int operation, TupleDesc typeinfo) if (is_matview) { /* StoreViewQuery scribbles on tree, so make a copy */ - Query *query = (Query *) copyObject(into->viewQuery); + Query *query = (Query *) copyObject(into->viewQuery); StoreViewQuery(intoRelationId, query, false); CommandCounterIncrement(); diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c index b3911bff350..0e10a752180 100644 --- a/src/backend/commands/dbcommands.c +++ b/src/backend/commands/dbcommands.c @@ -788,7 +788,7 @@ dropdb(const char *dbname, bool missing_ok) pgdbrel = heap_open(DatabaseRelationId, RowExclusiveLock); if (!get_db_info(dbname, AccessExclusiveLock, &db_id, NULL, NULL, - &db_istemplate, NULL, NULL, NULL, NULL, NULL, NULL, NULL)) + &db_istemplate, NULL, NULL, NULL, NULL, NULL, NULL, NULL)) { if (!missing_ok) { @@ -1043,7 +1043,7 @@ movedb(const char *dbname, const char *tblspcname) pgdbrel = heap_open(DatabaseRelationId, RowExclusiveLock); if (!get_db_info(dbname, AccessExclusiveLock, &db_id, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, &src_tblspcoid, NULL, NULL)) + NULL, NULL, NULL, NULL, NULL, &src_tblspcoid, NULL, NULL)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_DATABASE), errmsg("database \"%s\" does not exist", dbname))); @@ -1334,7 +1334,7 @@ Oid AlterDatabase(AlterDatabaseStmt *stmt, bool isTopLevel) { Relation rel; - Oid dboid; + Oid dboid; HeapTuple tuple, newtuple; ScanKeyData scankey; @@ -1882,8 +1882,11 @@ static int errdetail_busy_db(int notherbackends, int npreparedxacts) { if (notherbackends > 0 && npreparedxacts > 0) - /* We don't deal with singular versus plural here, since gettext - * doesn't support multiple plurals in one string. */ + + /* + * We don't deal with singular versus plural here, since gettext + * doesn't support multiple plurals in one string. + */ errdetail("There are %d other session(s) and %d prepared transaction(s) using the database.", notherbackends, npreparedxacts); else if (notherbackends > 0) @@ -1893,7 +1896,7 @@ errdetail_busy_db(int notherbackends, int npreparedxacts) notherbackends); else errdetail_plural("There is %d prepared transaction using the database.", - "There are %d prepared transactions using the database.", + "There are %d prepared transactions using the database.", npreparedxacts, npreparedxacts); return 0; /* just to keep ereport macro happy */ diff --git a/src/backend/commands/event_trigger.c b/src/backend/commands/event_trigger.c index 8af96e12b95..93d16798e24 100644 --- a/src/backend/commands/event_trigger.c +++ b/src/backend/commands/event_trigger.c @@ -47,16 +47,16 @@ typedef struct EventTriggerQueryState { slist_head SQLDropList; bool in_sql_drop; - MemoryContext cxt; + MemoryContext cxt; struct EventTriggerQueryState *previous; } EventTriggerQueryState; -EventTriggerQueryState *currentEventTriggerState = NULL; +EventTriggerQueryState *currentEventTriggerState = NULL; typedef struct { - const char *obtypename; - bool supported; + const char *obtypename; + bool supported; } event_trigger_support_data; typedef enum @@ -67,61 +67,61 @@ typedef enum } event_trigger_command_tag_check_result; static event_trigger_support_data event_trigger_support[] = { - { "AGGREGATE", true }, - { "CAST", true }, - { "CONSTRAINT", true }, - { "COLLATION", true }, - { "CONVERSION", true }, - { "DATABASE", false }, - { "DOMAIN", true }, - { "EXTENSION", true }, - { "EVENT TRIGGER", false }, - { "FOREIGN DATA WRAPPER", true }, - { "FOREIGN TABLE", true }, - { "FUNCTION", true }, - { "INDEX", true }, - { "LANGUAGE", true }, - { "MATERIALIZED VIEW", true }, - { "OPERATOR", true }, - { "OPERATOR CLASS", true }, - { "OPERATOR FAMILY", true }, - { "ROLE", false }, - { "RULE", true }, - { "SCHEMA", true }, - { "SEQUENCE", true }, - { "SERVER", true }, - { "TABLE", true }, - { "TABLESPACE", false}, - { "TRIGGER", true }, - { "TEXT SEARCH CONFIGURATION", true }, - { "TEXT SEARCH DICTIONARY", true }, - { "TEXT SEARCH PARSER", true }, - { "TEXT SEARCH TEMPLATE", true }, - { "TYPE", true }, - { "USER MAPPING", true }, - { "VIEW", true }, - { NULL, false } + {"AGGREGATE", true}, + {"CAST", true}, + {"CONSTRAINT", true}, + {"COLLATION", true}, + {"CONVERSION", true}, + {"DATABASE", false}, + {"DOMAIN", true}, + {"EXTENSION", true}, + {"EVENT TRIGGER", false}, + {"FOREIGN DATA WRAPPER", true}, + {"FOREIGN TABLE", true}, + {"FUNCTION", true}, + {"INDEX", true}, + {"LANGUAGE", true}, + {"MATERIALIZED VIEW", true}, + {"OPERATOR", true}, + {"OPERATOR CLASS", true}, + {"OPERATOR FAMILY", true}, + {"ROLE", false}, + {"RULE", true}, + {"SCHEMA", true}, + {"SEQUENCE", true}, + {"SERVER", true}, + {"TABLE", true}, + {"TABLESPACE", false}, + {"TRIGGER", true}, + {"TEXT SEARCH CONFIGURATION", true}, + {"TEXT SEARCH DICTIONARY", true}, + {"TEXT SEARCH PARSER", true}, + {"TEXT SEARCH TEMPLATE", true}, + {"TYPE", true}, + {"USER MAPPING", true}, + {"VIEW", true}, + {NULL, false} }; /* Support for dropped objects */ typedef struct SQLDropObject { - ObjectAddress address; - const char *schemaname; - const char *objname; - const char *objidentity; - const char *objecttype; - slist_node next; + ObjectAddress address; + const char *schemaname; + const char *objname; + const char *objidentity; + const char *objecttype; + slist_node next; } SQLDropObject; static void AlterEventTriggerOwner_internal(Relation rel, - HeapTuple tup, - Oid newOwnerId); + HeapTuple tup, + Oid newOwnerId); static event_trigger_command_tag_check_result check_ddl_tag(const char *tag); static void error_duplicate_filter_variable(const char *defname); static Datum filter_list_to_array(List *filterlist); static Oid insert_event_trigger_tuple(char *trigname, char *eventname, - Oid evtOwner, Oid funcoid, List *tags); + Oid evtOwner, Oid funcoid, List *tags); static void validate_ddl_tags(const char *filtervar, List *taglist); static void EventTriggerInvoke(List *fn_oid_list, EventTriggerData *trigdata); @@ -145,24 +145,24 @@ CreateEventTrigger(CreateEventTrigStmt *stmt) */ if (!superuser()) ereport(ERROR, - (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - errmsg("permission denied to create event trigger \"%s\"", - stmt->trigname), - errhint("Must be superuser to create an event trigger."))); + (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), + errmsg("permission denied to create event trigger \"%s\"", + stmt->trigname), + errhint("Must be superuser to create an event trigger."))); /* Validate event name. */ if (strcmp(stmt->eventname, "ddl_command_start") != 0 && strcmp(stmt->eventname, "ddl_command_end") != 0 && strcmp(stmt->eventname, "sql_drop") != 0) ereport(ERROR, - (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("unrecognized event name \"%s\"", - stmt->eventname))); + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("unrecognized event name \"%s\"", + stmt->eventname))); /* Validate filter conditions. */ - foreach (lc, stmt->whenclause) + foreach(lc, stmt->whenclause) { - DefElem *def = (DefElem *) lfirst(lc); + DefElem *def = (DefElem *) lfirst(lc); if (strcmp(def->defname, "tag") == 0) { @@ -172,8 +172,8 @@ CreateEventTrigger(CreateEventTrigStmt *stmt) } else ereport(ERROR, - (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("unrecognized filter variable \"%s\"", def->defname))); + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("unrecognized filter variable \"%s\"", def->defname))); } /* Validate tag list, if any. */ @@ -192,7 +192,7 @@ CreateEventTrigger(CreateEventTrigStmt *stmt) ereport(ERROR, (errcode(ERRCODE_DUPLICATE_OBJECT), errmsg("event trigger \"%s\" already exists", - stmt->trigname))); + stmt->trigname))); /* Find and validate the trigger function. */ funcoid = LookupFuncName(stmt->funcname, 0, NULL, false); @@ -216,7 +216,7 @@ validate_ddl_tags(const char *filtervar, List *taglist) { ListCell *lc; - foreach (lc, taglist) + foreach(lc, taglist) { const char *tag = strVal(lfirst(lc)); event_trigger_command_tag_check_result result; @@ -226,13 +226,13 @@ validate_ddl_tags(const char *filtervar, List *taglist) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("filter value \"%s\" not recognized for filter variable \"%s\"", - tag, filtervar))); + tag, filtervar))); if (result == EVENT_TRIGGER_COMMAND_TAG_NOT_SUPPORTED) ereport(ERROR, - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - /* translator: %s represents an SQL statement name */ - errmsg("event triggers are not supported for %s", - tag))); + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + /* translator: %s represents an SQL statement name */ + errmsg("event triggers are not supported for %s", + tag))); } } @@ -240,7 +240,7 @@ static event_trigger_command_tag_check_result check_ddl_tag(const char *tag) { const char *obtypename; - event_trigger_support_data *etsd; + event_trigger_support_data *etsd; /* * Handle some idiosyncratic special cases. @@ -287,7 +287,7 @@ error_duplicate_filter_variable(const char *defname) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("filter variable \"%s\" specified more than once", - defname))); + defname))); } /* @@ -297,12 +297,13 @@ static Oid insert_event_trigger_tuple(char *trigname, char *eventname, Oid evtOwner, Oid funcoid, List *taglist) { - Relation tgrel; - Oid trigoid; + Relation tgrel; + Oid trigoid; HeapTuple tuple; Datum values[Natts_pg_trigger]; bool nulls[Natts_pg_trigger]; - ObjectAddress myself, referenced; + ObjectAddress myself, + referenced; /* Open pg_event_trigger. */ tgrel = heap_open(EventTriggerRelationId, RowExclusiveLock); @@ -415,9 +416,9 @@ AlterEventTrigger(AlterEventTrigStmt *stmt) { Relation tgrel; HeapTuple tup; - Oid trigoid; + Oid trigoid; Form_pg_event_trigger evtForm; - char tgenabled = stmt->tgenabled; + char tgenabled = stmt->tgenabled; tgrel = heap_open(EventTriggerRelationId, RowExclusiveLock); @@ -427,7 +428,7 @@ AlterEventTrigger(AlterEventTrigStmt *stmt) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("event trigger \"%s\" does not exist", - stmt->trigname))); + stmt->trigname))); trigoid = HeapTupleGetOid(tup); @@ -498,7 +499,7 @@ AlterEventTriggerOwner_oid(Oid trigOid, Oid newOwnerId) if (!HeapTupleIsValid(tup)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("event trigger with OID %u does not exist", trigOid))); + errmsg("event trigger with OID %u does not exist", trigOid))); AlterEventTriggerOwner_internal(rel, tup, newOwnerId); @@ -528,9 +529,9 @@ AlterEventTriggerOwner_internal(Relation rel, HeapTuple tup, Oid newOwnerId) if (!superuser_arg(newOwnerId)) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - errmsg("permission denied to change owner of event trigger \"%s\"", - NameStr(form->evtname)), - errhint("The owner of an event trigger must be a superuser."))); + errmsg("permission denied to change owner of event trigger \"%s\"", + NameStr(form->evtname)), + errhint("The owner of an event trigger must be a superuser."))); form->evtowner = newOwnerId; simple_heap_update(rel, &tup->t_self, tup); @@ -570,7 +571,7 @@ get_event_trigger_oid(const char *trigname, bool missing_ok) * tags matching. */ static bool -filter_event_trigger(const char **tag, EventTriggerCacheItem *item) +filter_event_trigger(const char **tag, EventTriggerCacheItem *item) { /* * Filter by session replication role, knowing that we never see disabled @@ -598,7 +599,7 @@ filter_event_trigger(const char **tag, EventTriggerCacheItem *item) } /* - * Setup for running triggers for the given event. Return value is an OID list + * Setup for running triggers for the given event. Return value is an OID list * of functions to run; if there are any, trigdata is filled with an * appropriate EventTriggerData for them to receive. */ @@ -617,7 +618,7 @@ EventTriggerCommonSetup(Node *parsetree, * invoked to match up exactly with the list that CREATE EVENT TRIGGER * accepts. This debugging cross-check will throw an error if this * function is invoked for a command tag that CREATE EVENT TRIGGER won't - * accept. (Unfortunately, there doesn't seem to be any simple, automated + * accept. (Unfortunately, there doesn't seem to be any simple, automated * way to verify that CREATE EVENT TRIGGER doesn't accept extra stuff that * never reaches this control point.) * @@ -646,15 +647,15 @@ EventTriggerCommonSetup(Node *parsetree, tag = CreateCommandTag(parsetree); /* - * Filter list of event triggers by command tag, and copy them into - * our memory context. Once we start running the command trigers, or - * indeed once we do anything at all that touches the catalogs, an - * invalidation might leave cachelist pointing at garbage, so we must - * do this before we can do much else. + * Filter list of event triggers by command tag, and copy them into our + * memory context. Once we start running the command trigers, or indeed + * once we do anything at all that touches the catalogs, an invalidation + * might leave cachelist pointing at garbage, so we must do this before we + * can do much else. */ - foreach (lc, cachelist) + foreach(lc, cachelist) { - EventTriggerCacheItem *item = lfirst(lc); + EventTriggerCacheItem *item = lfirst(lc); if (filter_event_trigger(&tag, item)) { @@ -682,7 +683,7 @@ void EventTriggerDDLCommandStart(Node *parsetree) { List *runlist; - EventTriggerData trigdata; + EventTriggerData trigdata; /* * Event Triggers are completely disabled in standalone mode. There are @@ -704,7 +705,7 @@ EventTriggerDDLCommandStart(Node *parsetree) return; runlist = EventTriggerCommonSetup(parsetree, - EVT_DDLCommandStart, "ddl_command_start", + EVT_DDLCommandStart, "ddl_command_start", &trigdata); if (runlist == NIL) return; @@ -716,8 +717,8 @@ EventTriggerDDLCommandStart(Node *parsetree) list_free(runlist); /* - * Make sure anything the event triggers did will be visible to - * the main command. + * Make sure anything the event triggers did will be visible to the main + * command. */ CommandCounterIncrement(); } @@ -729,7 +730,7 @@ void EventTriggerDDLCommandEnd(Node *parsetree) { List *runlist; - EventTriggerData trigdata; + EventTriggerData trigdata; /* * See EventTriggerDDLCommandStart for a discussion about why event @@ -745,8 +746,8 @@ EventTriggerDDLCommandEnd(Node *parsetree) return; /* - * Make sure anything the main command did will be visible to the - * event triggers. + * Make sure anything the main command did will be visible to the event + * triggers. */ CommandCounterIncrement(); @@ -764,7 +765,7 @@ void EventTriggerSQLDrop(Node *parsetree) { List *runlist; - EventTriggerData trigdata; + EventTriggerData trigdata; /* * See EventTriggerDDLCommandStart for a discussion about why event @@ -774,10 +775,11 @@ EventTriggerSQLDrop(Node *parsetree) return; /* - * Use current state to determine whether this event fires at all. If there - * are no triggers for the sql_drop event, then we don't have anything to do - * here. Note that dropped object collection is disabled if this is the case, - * so even if we were to try to run, the list would be empty. + * Use current state to determine whether this event fires at all. If + * there are no triggers for the sql_drop event, then we don't have + * anything to do here. Note that dropped object collection is disabled + * if this is the case, so even if we were to try to run, the list would + * be empty. */ if (!currentEventTriggerState || slist_is_empty(¤tEventTriggerState->SQLDropList)) @@ -786,24 +788,25 @@ EventTriggerSQLDrop(Node *parsetree) runlist = EventTriggerCommonSetup(parsetree, EVT_SQLDrop, "sql_drop", &trigdata); + /* - * Nothing to do if run list is empty. Note this shouldn't happen, because - * if there are no sql_drop events, then objects-to-drop wouldn't have been - * collected in the first place and we would have quitted above. + * Nothing to do if run list is empty. Note this shouldn't happen, + * because if there are no sql_drop events, then objects-to-drop wouldn't + * have been collected in the first place and we would have quitted above. */ if (runlist == NIL) return; /* - * Make sure anything the main command did will be visible to the - * event triggers. + * Make sure anything the main command did will be visible to the event + * triggers. */ CommandCounterIncrement(); /* - * Make sure pg_event_trigger_dropped_objects only works when running these - * triggers. Use PG_TRY to ensure in_sql_drop is reset even when one - * trigger fails. (This is perhaps not necessary, as the currentState + * Make sure pg_event_trigger_dropped_objects only works when running + * these triggers. Use PG_TRY to ensure in_sql_drop is reset even when + * one trigger fails. (This is perhaps not necessary, as the currentState * variable will be removed shortly by our caller, but it seems better to * play safe.) */ @@ -832,17 +835,17 @@ EventTriggerSQLDrop(Node *parsetree) static void EventTriggerInvoke(List *fn_oid_list, EventTriggerData *trigdata) { - MemoryContext context; - MemoryContext oldcontext; - ListCell *lc; - bool first = true; + MemoryContext context; + MemoryContext oldcontext; + ListCell *lc; + bool first = true; /* Guard against stack overflow due to recursive event trigger */ check_stack_depth(); /* - * Let's evaluate event triggers in their own memory context, so - * that any leaks get cleaned up promptly. + * Let's evaluate event triggers in their own memory context, so that any + * leaks get cleaned up promptly. */ context = AllocSetContextCreate(CurrentMemoryContext, "event trigger context", @@ -852,18 +855,18 @@ EventTriggerInvoke(List *fn_oid_list, EventTriggerData *trigdata) oldcontext = MemoryContextSwitchTo(context); /* Call each event trigger. */ - foreach (lc, fn_oid_list) + foreach(lc, fn_oid_list) { - Oid fnoid = lfirst_oid(lc); - FmgrInfo flinfo; + Oid fnoid = lfirst_oid(lc); + FmgrInfo flinfo; FunctionCallInfoData fcinfo; PgStat_FunctionCallUsage fcusage; /* - * We want each event trigger to be able to see the results of - * the previous event trigger's action. Caller is responsible - * for any command-counter increment that is needed between the - * event trigger and anything else in the transaction. + * We want each event trigger to be able to see the results of the + * previous event trigger's action. Caller is responsible for any + * command-counter increment that is needed between the event trigger + * and anything else in the transaction. */ if (first) first = false; @@ -987,6 +990,7 @@ EventTriggerSupportsObjectClass(ObjectClass objclass) return true; case MAX_OCLASS: + /* * This shouldn't ever happen, but we keep the case to avoid a * compiler warning without a "default" clause in the switch. @@ -1008,7 +1012,7 @@ bool EventTriggerBeginCompleteQuery(void) { EventTriggerQueryState *state; - MemoryContext cxt; + MemoryContext cxt; /* * Currently, sql_drop events are the only reason to have event trigger @@ -1041,7 +1045,7 @@ EventTriggerBeginCompleteQuery(void) * returned false previously. * * Note: this might be called in the PG_CATCH block of a failing transaction, - * so be wary of running anything unnecessary. (In particular, it's probably + * so be wary of running anything unnecessary. (In particular, it's probably * unwise to try to allocate memory.) */ void @@ -1092,8 +1096,8 @@ trackDroppedObjectsNeeded(void) void EventTriggerSQLDropAddObject(ObjectAddress *object) { - SQLDropObject *obj; - MemoryContext oldcxt; + SQLDropObject *obj; + MemoryContext oldcxt; if (!currentEventTriggerState) return; @@ -1112,8 +1116,9 @@ EventTriggerSQLDropAddObject(ObjectAddress *object) /* * Obtain schema names from the object's catalog tuple, if one exists; - * this lets us skip objects in temp schemas. We trust that ObjectProperty - * contains all object classes that can be schema-qualified. + * this lets us skip objects in temp schemas. We trust that + * ObjectProperty contains all object classes that can be + * schema-qualified. */ if (is_objectclass_supported(object->classId)) { @@ -1136,7 +1141,7 @@ EventTriggerSQLDropAddObject(ObjectAddress *object) RelationGetDescr(catalog), &isnull); if (!isnull) { - Oid namespaceId; + Oid namespaceId; namespaceId = DatumGetObjectId(datum); /* Don't report objects in temp namespaces */ @@ -1189,12 +1194,12 @@ EventTriggerSQLDropAddObject(ObjectAddress *object) Datum pg_event_trigger_dropped_objects(PG_FUNCTION_ARGS) { - ReturnSetInfo *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo; - TupleDesc tupdesc; - Tuplestorestate *tupstore; - MemoryContext per_query_ctx; - MemoryContext oldcontext; - slist_iter iter; + ReturnSetInfo *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo; + TupleDesc tupdesc; + Tuplestorestate *tupstore; + MemoryContext per_query_ctx; + MemoryContext oldcontext; + slist_iter iter; /* * Protect this function from being called out of context @@ -1203,8 +1208,8 @@ pg_event_trigger_dropped_objects(PG_FUNCTION_ARGS) !currentEventTriggerState->in_sql_drop) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("%s can only be called in a sql_drop event trigger function", - "pg_event_trigger_dropped_objects()"))); + errmsg("%s can only be called in a sql_drop event trigger function", + "pg_event_trigger_dropped_objects()"))); /* check to see if caller supports us returning a tuplestore */ if (rsinfo == NULL || !IsA(rsinfo, ReturnSetInfo)) diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index c6398e3c8e7..91bea517ec8 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -415,8 +415,8 @@ ExplainOnePlan(PlannedStmt *plannedstmt, IntoClause *into, ExplainState *es, instrument_option |= INSTRUMENT_BUFFERS; /* - * We always collect timing for the entire statement, even when - * node-level timing is off, so we don't look at es->timing here. + * We always collect timing for the entire statement, even when node-level + * timing is off, so we don't look at es->timing here. */ INSTR_TIME_SET_CURRENT(starttime); diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c index 9f0ac9bd50a..38187a837c6 100644 --- a/src/backend/commands/functioncmds.c +++ b/src/backend/commands/functioncmds.c @@ -968,8 +968,8 @@ CreateFunction(CreateFunctionStmt *stmt, const char *queryString) GetUserId(), languageOid, languageValidator, - prosrc_str, /* converted to text later */ - probin_str, /* converted to text later */ + prosrc_str, /* converted to text later */ + probin_str, /* converted to text later */ false, /* not an aggregate */ isWindowFunc, security, diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c index 66eae92a4c1..7ea90d07d3c 100644 --- a/src/backend/commands/indexcmds.c +++ b/src/backend/commands/indexcmds.c @@ -351,7 +351,7 @@ DefineIndex(IndexStmt *stmt, * (but not VACUUM). */ rel = heap_openrv(stmt->relation, - (stmt->concurrent ? ShareUpdateExclusiveLock : ShareLock)); + (stmt->concurrent ? ShareUpdateExclusiveLock : ShareLock)); relationId = RelationGetRelid(rel); namespaceId = RelationGetNamespace(rel); @@ -774,7 +774,7 @@ DefineIndex(IndexStmt *stmt, * Drop the reference snapshot. We must do this before waiting out other * snapshot holders, else we will deadlock against other processes also * doing CREATE INDEX CONCURRENTLY, which would see our snapshot as one - * they must wait for. But first, save the snapshot's xmin to use as + * they must wait for. But first, save the snapshot's xmin to use as * limitXmin for GetCurrentVirtualXIDs(). */ limitXmin = snapshot->xmin; diff --git a/src/backend/commands/matview.c b/src/backend/commands/matview.c index 5491c84c766..2ffdca31f6b 100644 --- a/src/backend/commands/matview.c +++ b/src/backend/commands/matview.c @@ -49,7 +49,7 @@ static void transientrel_receive(TupleTableSlot *slot, DestReceiver *self); static void transientrel_shutdown(DestReceiver *self); static void transientrel_destroy(DestReceiver *self); static void refresh_matview_datafill(DestReceiver *dest, Query *query, - const char *queryString); + const char *queryString); /* * SetMatViewPopulatedState @@ -115,7 +115,7 @@ SetMatViewPopulatedState(Relation relation, bool newstate) */ void ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString, - ParamListInfo params, char *completionTag) + ParamListInfo params, char *completionTag) { Oid matviewOid; Relation matviewRel; @@ -130,8 +130,8 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString, * Get a lock until end of transaction. */ matviewOid = RangeVarGetRelidExtended(stmt->relation, - AccessExclusiveLock, false, false, - RangeVarCallbackOwnsTable, NULL); + AccessExclusiveLock, false, false, + RangeVarCallbackOwnsTable, NULL); matviewRel = heap_open(matviewOid, NoLock); /* Make sure it is a materialized view. */ @@ -226,7 +226,7 @@ static void refresh_matview_datafill(DestReceiver *dest, Query *query, const char *queryString) { - List *rewritten; + List *rewritten; PlannedStmt *plan; QueryDesc *queryDesc; @@ -295,7 +295,7 @@ static void transientrel_startup(DestReceiver *self, int operation, TupleDesc typeinfo) { DR_transientrel *myState = (DR_transientrel *) self; - Relation transientrel; + Relation transientrel; transientrel = heap_open(myState->transientoid, NoLock); diff --git a/src/backend/commands/opclasscmds.c b/src/backend/commands/opclasscmds.c index 68ec57ac4b6..f2d78ef6632 100644 --- a/src/backend/commands/opclasscmds.c +++ b/src/backend/commands/opclasscmds.c @@ -1683,7 +1683,7 @@ get_am_name(Oid amOid) * Subroutine for ALTER OPERATOR CLASS SET SCHEMA/RENAME * * Is there an operator class with the given name and signature already - * in the given namespace? If so, raise an appropriate error message. + * in the given namespace? If so, raise an appropriate error message. */ void IsThereOpClassInNamespace(const char *opcname, Oid opcmethod, @@ -1706,7 +1706,7 @@ IsThereOpClassInNamespace(const char *opcname, Oid opcmethod, * Subroutine for ALTER OPERATOR FAMILY SET SCHEMA/RENAME * * Is there an operator family with the given name and signature already - * in the given namespace? If so, raise an appropriate error message. + * in the given namespace? If so, raise an appropriate error message. */ void IsThereOpFamilyInNamespace(const char *opfname, Oid opfmethod, diff --git a/src/backend/commands/operatorcmds.c b/src/backend/commands/operatorcmds.c index e451414b149..4692b087bef 100644 --- a/src/backend/commands/operatorcmds.c +++ b/src/backend/commands/operatorcmds.c @@ -296,15 +296,15 @@ DefineOperator(List *names, List *parameters) * now have OperatorCreate do all the work.. */ return - OperatorCreate(oprName, /* operator name */ + OperatorCreate(oprName, /* operator name */ oprNamespace, /* namespace */ - typeId1, /* left type id */ - typeId2, /* right type id */ - functionOid, /* function for operator */ - commutatorName, /* optional commutator operator name */ - negatorName, /* optional negator operator name */ - restrictionOid, /* optional restrict. sel. procedure */ - joinOid, /* optional join sel. procedure name */ + typeId1, /* left type id */ + typeId2, /* right type id */ + functionOid, /* function for operator */ + commutatorName, /* optional commutator operator name */ + negatorName, /* optional negator operator name */ + restrictionOid, /* optional restrict. sel. procedure */ + joinOid, /* optional join sel. procedure name */ canMerge, /* operator merges */ canHash); /* operator hashes */ } diff --git a/src/backend/commands/proclang.c b/src/backend/commands/proclang.c index 1c98c3226d0..6e4c682072d 100644 --- a/src/backend/commands/proclang.c +++ b/src/backend/commands/proclang.c @@ -52,8 +52,8 @@ typedef struct } PLTemplate; static Oid create_proc_lang(const char *languageName, bool replace, - Oid languageOwner, Oid handlerOid, Oid inlineOid, - Oid valOid, bool trusted); + Oid languageOwner, Oid handlerOid, Oid inlineOid, + Oid valOid, bool trusted); static PLTemplate *find_language_template(const char *languageName); /* --------------------------------------------------------------------- diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c index 49e409a5eed..bffc12ed0e9 100644 --- a/src/backend/commands/sequence.c +++ b/src/backend/commands/sequence.c @@ -698,8 +698,8 @@ nextval_internal(Oid relid) /* * We must mark the buffer dirty before doing XLogInsert(); see notes in * SyncOneBuffer(). However, we don't apply the desired changes just yet. - * This looks like a violation of the buffer update protocol, but it is - * in fact safe because we hold exclusive lock on the buffer. Any other + * This looks like a violation of the buffer update protocol, but it is in + * fact safe because we hold exclusive lock on the buffer. Any other * process, including a checkpoint, that tries to examine the buffer * contents will block until we release the lock, and then will see the * final state that we install below. @@ -1226,8 +1226,8 @@ init_params(List *options, bool isInit, } /* - * We must reset log_cnt when isInit or when changing any parameters - * that would affect future nextval allocations. + * We must reset log_cnt when isInit or when changing any parameters that + * would affect future nextval allocations. */ if (isInit) new->log_cnt = 0; diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index fe328349533..a3f4ce2c52e 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -271,7 +271,7 @@ static void StoreCatalogInheritance1(Oid relationId, Oid parentOid, int16 seqNumber, Relation inhRelation); static int findAttrByName(const char *attributeName, List *schema); static void AlterIndexNamespaces(Relation classRel, Relation rel, - Oid oldNspOid, Oid newNspOid, ObjectAddresses *objsMoved); + Oid oldNspOid, Oid newNspOid, ObjectAddresses *objsMoved); static void AlterSeqNamespaces(Relation classRel, Relation rel, Oid oldNspOid, Oid newNspOid, ObjectAddresses *objsMoved, LOCKMODE lockmode); @@ -1141,7 +1141,7 @@ ExecuteTruncate(TruncateStmt *stmt) { Oid heap_relid; Oid toast_relid; - MultiXactId minmulti; + MultiXactId minmulti; /* * This effectively deletes all rows in the table, and may be done @@ -1675,14 +1675,14 @@ MergeAttributes(List *schema, List *supers, char relpersistence, &found_whole_row); /* - * For the moment we have to reject whole-row variables. - * We could convert them, if we knew the new table's rowtype - * OID, but that hasn't been assigned yet. + * For the moment we have to reject whole-row variables. We + * could convert them, if we knew the new table's rowtype OID, + * but that hasn't been assigned yet. */ if (found_whole_row) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot convert whole-row table reference"), + errmsg("cannot convert whole-row table reference"), errdetail("Constraint \"%s\" contains a whole-row reference to table \"%s\".", name, RelationGetRelationName(relation)))); @@ -2122,7 +2122,7 @@ renameatt_internal(Oid myrelid, Relation targetrelation; Relation attrelation; HeapTuple atttup; - Form_pg_attribute attform; + Form_pg_attribute attform; int attnum; /* @@ -2438,8 +2438,8 @@ RenameConstraint(RenameStmt *stmt) rename_constraint_internal(relid, typid, stmt->subname, stmt->newname, - stmt->relation ? interpretInhOption(stmt->relation->inhOpt) : false, /* recursive? */ - false, /* recursing? */ + stmt->relation ? interpretInhOption(stmt->relation->inhOpt) : false, /* recursive? */ + false, /* recursing? */ 0 /* expected inhcount */ ); } @@ -2795,7 +2795,7 @@ AlterTableGetLockLevel(List *cmds) case AT_ColumnDefault: case AT_ProcessedConstraint: /* becomes AT_AddConstraint */ case AT_AddConstraintRecurse: /* becomes AT_AddConstraint */ - case AT_ReAddConstraint: /* becomes AT_AddConstraint */ + case AT_ReAddConstraint: /* becomes AT_AddConstraint */ case AT_EnableTrig: case AT_EnableAlwaysTrig: case AT_EnableReplicaTrig: @@ -3294,7 +3294,8 @@ ATExecCmd(List **wqueue, AlteredTableInfo *tab, Relation rel, ATExecAddConstraint(wqueue, tab, rel, (Constraint *) cmd->def, true, false, lockmode); break; - case AT_ReAddConstraint: /* Re-add pre-existing check constraint */ + case AT_ReAddConstraint: /* Re-add pre-existing check + * constraint */ ATExecAddConstraint(wqueue, tab, rel, (Constraint *) cmd->def, false, true, lockmode); break; @@ -3855,7 +3856,7 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap, LOCKMODE lockmode) ereport(ERROR, (errcode(ERRCODE_NOT_NULL_VIOLATION), errmsg("column \"%s\" contains null values", - NameStr(newTupDesc->attrs[attn]->attname)), + NameStr(newTupDesc->attrs[attn]->attname)), errtablecol(oldrel, attn + 1))); } @@ -5566,10 +5567,10 @@ ATExecAddIndexConstraint(AlteredTableInfo *tab, Relation rel, stmt->deferrable, stmt->initdeferred, stmt->primary, - true, /* update pg_index */ - true, /* remove old dependencies */ + true, /* update pg_index */ + true, /* remove old dependencies */ allowSystemTableMods, - false); /* is_internal */ + false); /* is_internal */ index_close(indexRel, NoLock); } @@ -9023,14 +9024,14 @@ ATExecAddInherit(Relation child_rel, RangeVar *parent, LOCKMODE lockmode) !parent_rel->rd_islocaltemp) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), - errmsg("cannot inherit from temporary relation of another session"))); + errmsg("cannot inherit from temporary relation of another session"))); /* Ditto for the child */ if (child_rel->rd_rel->relpersistence == RELPERSISTENCE_TEMP && !child_rel->rd_islocaltemp) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), - errmsg("cannot inherit to temporary relation of another session"))); + errmsg("cannot inherit to temporary relation of another session"))); /* * Check for duplicates in the list of parents, and determine the highest @@ -9564,9 +9565,9 @@ ATExecDropInherit(Relation rel, RangeVar *parent, LOCKMODE lockmode) RelationGetRelid(parent_rel)); /* - * Post alter hook of this inherits. Since object_access_hook doesn't - * take multiple object identifiers, we relay oid of parent relation - * using auxiliary_id argument. + * Post alter hook of this inherits. Since object_access_hook doesn't take + * multiple object identifiers, we relay oid of parent relation using + * auxiliary_id argument. */ InvokeObjectPostAlterHookArg(InheritsRelationId, RelationGetRelid(rel), 0, @@ -9984,11 +9985,11 @@ AlterTableNamespaceInternal(Relation rel, Oid oldNspOid, Oid nspOid, void AlterRelationNamespaceInternal(Relation classRel, Oid relOid, Oid oldNspOid, Oid newNspOid, - bool hasDependEntry, ObjectAddresses *objsMoved) + bool hasDependEntry, ObjectAddresses *objsMoved) { HeapTuple classTup; Form_pg_class classForm; - ObjectAddress thisobj; + ObjectAddress thisobj; classTup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relOid)); if (!HeapTupleIsValid(classTup)) @@ -10024,7 +10025,7 @@ AlterRelationNamespaceInternal(Relation classRel, Oid relOid, /* Update dependency on schema if caller said so */ if (hasDependEntry && changeDependencyFor(RelationRelationId, relOid, - NamespaceRelationId, oldNspOid, newNspOid) != 1) + NamespaceRelationId, oldNspOid, newNspOid) != 1) elog(ERROR, "failed to change schema dependency for relation \"%s\"", NameStr(classForm->relname)); @@ -10247,6 +10248,7 @@ PreCommit_on_commit_actions(void) /* Do nothing (there shouldn't be such entries, actually) */ break; case ONCOMMIT_DELETE_ROWS: + /* * If this transaction hasn't accessed any temporary * relations, we can skip truncating ON COMMIT DELETE ROWS @@ -10379,7 +10381,7 @@ AtEOSubXact_on_commit_actions(bool isCommit, SubTransactionId mySubid, * This is intended as a callback for RangeVarGetRelidExtended(). It allows * the relation to be locked only if (1) it's a plain table, materialized * view, or TOAST table and (2) the current user is the owner (or the - * superuser). This meets the permission-checking needs of CLUSTER, REINDEX + * superuser). This meets the permission-checking needs of CLUSTER, REINDEX * TABLE, and REFRESH MATERIALIZED VIEW; we expose it here so that it can be * used by all. */ diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c index a0473498bd2..851947643c2 100644 --- a/src/backend/commands/trigger.c +++ b/src/backend/commands/trigger.c @@ -447,7 +447,7 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString, true, /* islocal */ 0, /* inhcount */ true, /* isnoinherit */ - isInternal); /* is_internal */ + isInternal); /* is_internal */ } /* @@ -1266,6 +1266,7 @@ renametrig(RenameStmt *stmt) if (HeapTupleIsValid(tuple = systable_getnext(tgscan))) { tgoid = HeapTupleGetOid(tuple); + /* * Update pg_trigger tuple with new tgname. */ @@ -2210,7 +2211,7 @@ ExecARDeleteTriggers(EState *estate, ResultRelInfo *relinfo, if (trigdesc && trigdesc->trig_delete_after_row) { HeapTuple trigtuple = GetTupleForTrigger(estate, NULL, relinfo, - tupleid, LockTupleExclusive, + tupleid, LockTupleExclusive, NULL); AfterTriggerSaveEvent(estate, relinfo, TRIGGER_EVENT_DELETE, @@ -2449,7 +2450,7 @@ ExecARUpdateTriggers(EState *estate, ResultRelInfo *relinfo, if (trigdesc && trigdesc->trig_update_after_row) { HeapTuple trigtuple = GetTupleForTrigger(estate, NULL, relinfo, - tupleid, LockTupleExclusive, + tupleid, LockTupleExclusive, NULL); AfterTriggerSaveEvent(estate, relinfo, TRIGGER_EVENT_UPDATE, @@ -2614,11 +2615,12 @@ ltrmark:; tuple.t_self = *tid; test = heap_lock_tuple(relation, &tuple, estate->es_output_cid, - lockmode, false /* wait */, + lockmode, false /* wait */ , false, &buffer, &hufd); switch (test) { case HeapTupleSelfUpdated: + /* * The target tuple was already updated or deleted by the * current command, or by a later command in the current diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c index 9efe24417e5..6bc16f198e3 100644 --- a/src/backend/commands/typecmds.c +++ b/src/backend/commands/typecmds.c @@ -598,32 +598,32 @@ DefineType(List *names, List *parameters) array_type, /* type name */ typeNamespace, /* namespace */ InvalidOid, /* relation oid (n/a here) */ - 0, /* relation kind (ditto) */ - GetUserId(), /* owner's ID */ - -1, /* internal size (always varlena) */ + 0, /* relation kind (ditto) */ + GetUserId(), /* owner's ID */ + -1, /* internal size (always varlena) */ TYPTYPE_BASE, /* type-type (base type) */ TYPCATEGORY_ARRAY, /* type-category (array) */ - false, /* array types are never preferred */ + false, /* array types are never preferred */ delimiter, /* array element delimiter */ F_ARRAY_IN, /* input procedure */ - F_ARRAY_OUT, /* output procedure */ + F_ARRAY_OUT, /* output procedure */ F_ARRAY_RECV, /* receive procedure */ F_ARRAY_SEND, /* send procedure */ - typmodinOid, /* typmodin procedure */ + typmodinOid, /* typmodin procedure */ typmodoutOid, /* typmodout procedure */ F_ARRAY_TYPANALYZE, /* analyze procedure */ - typoid, /* element type ID */ - true, /* yes this is an array type */ + typoid, /* element type ID */ + true, /* yes this is an array type */ InvalidOid, /* no further array type */ InvalidOid, /* base type ID */ - NULL, /* never a default type value */ - NULL, /* binary default isn't sent either */ - false, /* never passed by value */ + NULL, /* never a default type value */ + NULL, /* binary default isn't sent either */ + false, /* never passed by value */ alignment, /* see above */ - 'x', /* ARRAY is always toastable */ - -1, /* typMod (Domains only) */ - 0, /* Array dimensions of typbasetype */ - false, /* Type NOT NULL */ + 'x', /* ARRAY is always toastable */ + -1, /* typMod (Domains only) */ + 0, /* Array dimensions of typbasetype */ + false, /* Type NOT NULL */ collation); /* type's collation */ pfree(array_type); @@ -924,8 +924,8 @@ DefineDomain(CreateDomainStmt *stmt) /* * Check constraints are handled after domain creation, as * they require the Oid of the domain; at this point we can - * only check that they're not marked NO INHERIT, because - * that would be bogus. + * only check that they're not marked NO INHERIT, because that + * would be bogus. */ if (constr->is_no_inherit) ereport(ERROR, @@ -1191,19 +1191,19 @@ AlterEnum(AlterEnumStmt *stmt, bool isTopLevel) /* * Ordinarily we disallow adding values within transaction blocks, because * we can't cope with enum OID values getting into indexes and then having - * their defining pg_enum entries go away. However, it's okay if the enum - * type was created in the current transaction, since then there can be - * no such indexes that wouldn't themselves go away on rollback. (We - * support this case because pg_dump --binary-upgrade needs it.) We test - * this by seeing if the pg_type row has xmin == current XID and is not - * HEAP_UPDATED. If it is HEAP_UPDATED, we can't be sure whether the - * type was created or only modified in this xact. So we are disallowing - * some cases that could theoretically be safe; but fortunately pg_dump - * only needs the simplest case. + * their defining pg_enum entries go away. However, it's okay if the enum + * type was created in the current transaction, since then there can be no + * such indexes that wouldn't themselves go away on rollback. (We support + * this case because pg_dump --binary-upgrade needs it.) We test this by + * seeing if the pg_type row has xmin == current XID and is not + * HEAP_UPDATED. If it is HEAP_UPDATED, we can't be sure whether the type + * was created or only modified in this xact. So we are disallowing some + * cases that could theoretically be safe; but fortunately pg_dump only + * needs the simplest case. */ if (HeapTupleHeaderGetXmin(tup->t_data) == GetCurrentTransactionId() && !(tup->t_data->t_infomask & HEAP_UPDATED)) - /* safe to do inside transaction block */ ; + /* safe to do inside transaction block */ ; else PreventTransactionChain(isTopLevel, "ALTER TYPE ... ADD"); @@ -2273,7 +2273,7 @@ AlterDomainNotNull(List *names, bool notNull) /* * In principle the auxiliary information for this * error should be errdatatype(), but errtablecol() - * seems considerably more useful in practice. Since + * seems considerably more useful in practice. Since * this code only executes in an ALTER DOMAIN command, * the client should already know which domain is in * question. @@ -2667,7 +2667,7 @@ validateDomainConstraint(Oid domainoid, char *ccbin) /* * In principle the auxiliary information for this error * should be errdomainconstraint(), but errtablecol() - * seems considerably more useful in practice. Since this + * seems considerably more useful in practice. Since this * code only executes in an ALTER DOMAIN command, the * client should already know which domain is in question, * and which constraint too. @@ -3005,7 +3005,7 @@ domainAddConstraint(Oid domainOid, Oid domainNamespace, Oid baseTypeOid, true, /* is local */ 0, /* inhcount */ false, /* connoinherit */ - false); /* is_internal */ + false); /* is_internal */ /* * Return the compiled constraint expression so the calling routine can @@ -3348,7 +3348,7 @@ AlterTypeOwner(List *names, Oid newOwnerId, ObjectType objecttype) * hasDependEntry should be TRUE if type is expected to have a pg_shdepend * entry (ie, it's not a table rowtype nor an array type). * is_primary_ops should be TRUE if this function is invoked with user's - * direct operation (e.g, shdepReassignOwned). Elsewhere, + * direct operation (e.g, shdepReassignOwned). Elsewhere, */ void AlterTypeOwnerInternal(Oid typeOid, Oid newOwnerId, @@ -3397,7 +3397,7 @@ AlterTypeNamespace(List *names, const char *newschema, ObjectType objecttype) TypeName *typename; Oid typeOid; Oid nspOid; - ObjectAddresses *objsMoved; + ObjectAddresses *objsMoved; /* Make a TypeName so we can use standard type lookup machinery */ typename = makeTypeNameFromNameList(names); diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c index c7886ed799e..844f25cfa65 100644 --- a/src/backend/commands/user.c +++ b/src/backend/commands/user.c @@ -815,7 +815,7 @@ AlterRoleSet(AlterRoleSetStmt *stmt) { HeapTuple roletuple; Oid databaseid = InvalidOid; - Oid roleid = InvalidOid; + Oid roleid = InvalidOid; if (stmt->role) { diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index c984488e034..641c740268a 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -327,10 +327,10 @@ get_rel_oids(Oid relid, const RangeVar *vacrel) * Since we don't take a lock here, the relation might be gone, or the * RangeVar might no longer refer to the OID we look up here. In the * former case, VACUUM will do nothing; in the latter case, it will - * process the OID we looked up here, rather than the new one. - * Neither is ideal, but there's little practical alternative, since - * we're going to commit this transaction and begin a new one between - * now and then. + * process the OID we looked up here, rather than the new one. Neither + * is ideal, but there's little practical alternative, since we're + * going to commit this transaction and begin a new one between now + * and then. */ relid = RangeVarGetRelid(vacrel, NoLock, false); @@ -471,7 +471,7 @@ vacuum_set_xid_limits(int freeze_min_age, if (multiXactFrzLimit != NULL) { - MultiXactId mxLimit; + MultiXactId mxLimit; /* * simplistic multixactid freezing: use the same freezing policy as @@ -711,7 +711,7 @@ vac_update_datfrozenxid(void) SysScanDesc scan; HeapTuple classTup; TransactionId newFrozenXid; - MultiXactId newFrozenMulti; + MultiXactId newFrozenMulti; bool dirty = false; /* @@ -723,8 +723,8 @@ vac_update_datfrozenxid(void) newFrozenXid = GetOldestXmin(true, true); /* - * Similarly, initialize the MultiXact "min" with the value that would - * be used on pg_class for new tables. See AddNewRelationTuple(). + * Similarly, initialize the MultiXact "min" with the value that would be + * used on pg_class for new tables. See AddNewRelationTuple(). */ newFrozenMulti = GetOldestMultiXactId(); @@ -900,8 +900,8 @@ vac_truncate_clog(TransactionId frozenXID, MultiXactId frozenMulti) /* * Update the wrap limit for GetNewTransactionId and creation of new - * MultiXactIds. Note: these functions will also signal the postmaster for - * an(other) autovac cycle if needed. XXX should we avoid possibly + * MultiXactIds. Note: these functions will also signal the postmaster + * for an(other) autovac cycle if needed. XXX should we avoid possibly * signalling twice? */ SetTransactionIdLimit(frozenXID, oldestxid_datoid); diff --git a/src/backend/commands/vacuumlazy.c b/src/backend/commands/vacuumlazy.c index 9d304153b8b..7e46f9e9343 100644 --- a/src/backend/commands/vacuumlazy.c +++ b/src/backend/commands/vacuumlazy.c @@ -78,9 +78,9 @@ * that the potential for improvement was great enough to merit the cost of * supporting them. */ -#define VACUUM_TRUNCATE_LOCK_CHECK_INTERVAL 20 /* ms */ -#define VACUUM_TRUNCATE_LOCK_WAIT_INTERVAL 50 /* ms */ -#define VACUUM_TRUNCATE_LOCK_TIMEOUT 5000 /* ms */ +#define VACUUM_TRUNCATE_LOCK_CHECK_INTERVAL 20 /* ms */ +#define VACUUM_TRUNCATE_LOCK_WAIT_INTERVAL 50 /* ms */ +#define VACUUM_TRUNCATE_LOCK_TIMEOUT 5000 /* ms */ /* * Guesstimation of number of dead tuples per page. This is used to @@ -184,7 +184,7 @@ lazy_vacuum_rel(Relation onerel, VacuumStmt *vacstmt, double new_rel_tuples; BlockNumber new_rel_allvisible; TransactionId new_frozen_xid; - MultiXactId new_min_multi; + MultiXactId new_min_multi; /* measure elapsed time iff autovacuum logging requires it */ if (IsAutoVacuumWorkerProcess() && Log_autovacuum_min_duration >= 0) @@ -287,8 +287,8 @@ lazy_vacuum_rel(Relation onerel, VacuumStmt *vacstmt, /* report results to the stats collector, too */ pgstat_report_vacuum(RelationGetRelid(onerel), - onerel->rd_rel->relisshared, - new_rel_tuples); + onerel->rd_rel->relisshared, + new_rel_tuples); /* and log the action if appropriate */ if (IsAutoVacuumWorkerProcess() && Log_autovacuum_min_duration >= 0) @@ -315,7 +315,7 @@ lazy_vacuum_rel(Relation onerel, VacuumStmt *vacstmt, "pages: %d removed, %d remain\n" "tuples: %.0f removed, %.0f remain\n" "buffer usage: %d hits, %d misses, %d dirtied\n" - "avg read rate: %.3f MB/s, avg write rate: %.3f MB/s\n" + "avg read rate: %.3f MB/s, avg write rate: %.3f MB/s\n" "system usage: %s", get_database_name(MyDatabaseId), get_namespace_name(RelationGetNamespace(onerel)), @@ -899,15 +899,15 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats, /* * It should never be the case that the visibility map page is set * while the page-level bit is clear, but the reverse is allowed - * (if checksums are not enabled). Regardless, set the both bits + * (if checksums are not enabled). Regardless, set the both bits * so that we get back in sync. * * NB: If the heap page is all-visible but the VM bit is not set, - * we don't need to dirty the heap page. However, if checksums are - * enabled, we do need to make sure that the heap page is dirtied - * before passing it to visibilitymap_set(), because it may be - * logged. Given that this situation should only happen in rare - * cases after a crash, it is not worth optimizing. + * we don't need to dirty the heap page. However, if checksums + * are enabled, we do need to make sure that the heap page is + * dirtied before passing it to visibilitymap_set(), because it + * may be logged. Given that this situation should only happen in + * rare cases after a crash, it is not worth optimizing. */ PageSetAllVisible(page); MarkBufferDirty(buf); @@ -1116,7 +1116,7 @@ lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer, Page page = BufferGetPage(buffer); OffsetNumber unused[MaxOffsetNumber]; int uncnt = 0; - TransactionId visibility_cutoff_xid; + TransactionId visibility_cutoff_xid; START_CRIT_SECTION(); @@ -1146,8 +1146,8 @@ lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer, MarkBufferDirty(buffer); /* - * Now that we have removed the dead tuples from the page, once again check - * if the page has become all-visible. + * Now that we have removed the dead tuples from the page, once again + * check if the page has become all-visible. */ if (!visibilitymap_test(onerel, blkno, vmbuffer) && heap_page_is_all_visible(buffer, &visibility_cutoff_xid)) @@ -1155,7 +1155,7 @@ lazy_vacuum_page(Relation onerel, BlockNumber blkno, Buffer buffer, Assert(BufferIsValid(*vmbuffer)); PageSetAllVisible(page); visibilitymap_set(onerel, blkno, buffer, InvalidXLogRecPtr, *vmbuffer, - visibility_cutoff_xid); + visibility_cutoff_xid); } /* XLOG stuff */ @@ -1660,25 +1660,24 @@ vac_cmp_itemptr(const void *left, const void *right) static bool heap_page_is_all_visible(Buffer buf, TransactionId *visibility_cutoff_xid) { - Page page = BufferGetPage(buf); + Page page = BufferGetPage(buf); OffsetNumber offnum, - maxoff; - bool all_visible = true; + maxoff; + bool all_visible = true; *visibility_cutoff_xid = InvalidTransactionId; /* * This is a stripped down version of the line pointer scan in - * lazy_scan_heap(). So if you change anything here, also check that - * code. + * lazy_scan_heap(). So if you change anything here, also check that code. */ maxoff = PageGetMaxOffsetNumber(page); for (offnum = FirstOffsetNumber; - offnum <= maxoff && all_visible; - offnum = OffsetNumberNext(offnum)) + offnum <= maxoff && all_visible; + offnum = OffsetNumberNext(offnum)) { - ItemId itemid; - HeapTupleData tuple; + ItemId itemid; + HeapTupleData tuple; itemid = PageGetItemId(page, offnum); @@ -1689,8 +1688,8 @@ heap_page_is_all_visible(Buffer buf, TransactionId *visibility_cutoff_xid) ItemPointerSet(&(tuple.t_self), BufferGetBlockNumber(buf), offnum); /* - * Dead line pointers can have index pointers pointing to them. So they - * can't be treated as visible + * Dead line pointers can have index pointers pointing to them. So + * they can't be treated as visible */ if (ItemIdIsDead(itemid)) { @@ -1716,8 +1715,8 @@ heap_page_is_all_visible(Buffer buf, TransactionId *visibility_cutoff_xid) } /* - * The inserter definitely committed. But is it old - * enough that everyone sees it as committed? + * The inserter definitely committed. But is it old enough + * that everyone sees it as committed? */ xmin = HeapTupleHeaderGetXmin(tuple.t_data); if (!TransactionIdPrecedes(xmin, OldestXmin)) @@ -1743,7 +1742,7 @@ heap_page_is_all_visible(Buffer buf, TransactionId *visibility_cutoff_xid) elog(ERROR, "unexpected HeapTupleSatisfiesVacuum result"); break; } - } /* scan along page */ + } /* scan along page */ return all_visible; } |