diff options
author | Bruce Momjian <bruce@momjian.us> | 2007-11-15 21:14:46 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2007-11-15 21:14:46 +0000 |
commit | fdf5a5efb7b28c13085fe7313658de8d7b9914f6 (patch) | |
tree | a75cf1422fa1eef4e801cf502b148d8ce1b5dfe7 /src/backend/tcop | |
parent | 3adc760fb92eab1a8720337a8bf9b66486609eb3 (diff) | |
download | postgresql-fdf5a5efb7b28c13085fe7313658de8d7b9914f6.tar.gz postgresql-fdf5a5efb7b28c13085fe7313658de8d7b9914f6.zip |
pgindent run for 8.3.
Diffstat (limited to 'src/backend/tcop')
-rw-r--r-- | src/backend/tcop/postgres.c | 58 | ||||
-rw-r--r-- | src/backend/tcop/pquery.c | 26 | ||||
-rw-r--r-- | src/backend/tcop/utility.c | 59 |
3 files changed, 75 insertions, 68 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index b5ecea2d064..43435966c95 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.537 2007/08/02 23:39:44 adunstan Exp $ + * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.538 2007/11/15 21:14:38 momjian Exp $ * * NOTES * this is the "main" module of the postgres backend and @@ -142,6 +142,7 @@ static bool ignore_till_sync = false; * in order to reduce overhead for short-lived queries. */ static CachedPlanSource *unnamed_stmt_psrc = NULL; + /* workspace for building a new unnamed statement in */ static MemoryContext unnamed_stmt_context = NULL; @@ -214,8 +215,8 @@ InteractiveBackend(StringInfo inBuf) if (UseNewLine) { /* - * if we are using \n as a delimiter, then read characters until - * the \n. + * if we are using \n as a delimiter, then read characters until the + * \n. */ while ((c = interactive_getc()) != EOF) { @@ -833,10 +834,10 @@ exec_simple_query(const char *query_string) MemoryContextSwitchTo(oldcontext); /* - * We'll tell PortalRun it's a top-level command iff there's exactly - * one raw parsetree. If more than one, it's effectively a transaction - * block and we want PreventTransactionChain to reject unsafe commands. - * (Note: we're assuming that query rewrite cannot add commands that are + * We'll tell PortalRun it's a top-level command iff there's exactly one + * raw parsetree. If more than one, it's effectively a transaction block + * and we want PreventTransactionChain to reject unsafe commands. (Note: + * we're assuming that query rewrite cannot add commands that are * significant to PreventTransactionChain.) */ isTopLevel = (list_length(parsetree_list) == 1); @@ -1173,8 +1174,8 @@ exec_parse_message(const char *query_string, /* string to execute */ * originally specified parameter set is not required to be complete, * so we have to use parse_analyze_varparams(). * - * XXX must use copyObject here since parse analysis scribbles on - * its input, and we need the unmodified raw parse tree for possible + * XXX must use copyObject here since parse analysis scribbles on its + * input, and we need the unmodified raw parse tree for possible * replanning later. */ if (log_parser_stats) @@ -1242,7 +1243,7 @@ exec_parse_message(const char *query_string, /* string to execute */ commandTag, paramTypes, numParams, - 0, /* default cursor options */ + 0, /* default cursor options */ stmt_list, false); } @@ -1252,7 +1253,7 @@ exec_parse_message(const char *query_string, /* string to execute */ * paramTypes and query_string need to be copied into * unnamed_stmt_context. The rest is there already */ - Oid *newParamTypes; + Oid *newParamTypes; if (numParams > 0) { @@ -1267,7 +1268,7 @@ exec_parse_message(const char *query_string, /* string to execute */ commandTag, newParamTypes, numParams, - 0, /* cursor options */ + 0, /* cursor options */ stmt_list, fully_planned, true, @@ -1413,7 +1414,7 @@ exec_bind_message(StringInfo input_message) ereport(ERROR, (errcode(ERRCODE_PROTOCOL_VIOLATION), errmsg("bind message supplies %d parameters, but prepared statement \"%s\" requires %d", - numParams, stmt_name, psrc->num_params))); + numParams, stmt_name, psrc->num_params))); /* * If we are in aborted transaction state, the only portals we can @@ -1597,8 +1598,8 @@ exec_bind_message(StringInfo input_message) { /* * Revalidate the cached plan; this may result in replanning. Any - * cruft will be generated in MessageContext. The plan refcount - * will be assigned to the Portal, so it will be released at portal + * cruft will be generated in MessageContext. The plan refcount will + * be assigned to the Portal, so it will be released at portal * destruction. */ cplan = RevalidateCachedPlan(psrc, false); @@ -1680,7 +1681,7 @@ exec_bind_message(StringInfo input_message) *stmt_name ? stmt_name : "<unnamed>", *portal_name ? "/" : "", *portal_name ? portal_name : "", - psrc->query_string ? psrc->query_string : "<source not stored>"), + psrc->query_string ? psrc->query_string : "<source not stored>"), errhidestmt(true), errdetail_params(params))); break; @@ -1842,7 +1843,7 @@ exec_execute_message(const char *portal_name, long max_rows) completed = PortalRun(portal, max_rows, - true, /* always top level */ + true, /* always top level */ receiver, receiver, completionTag); @@ -2134,8 +2135,8 @@ exec_describe_statement_message(const char *stmt_name) /* * If we are in aborted transaction state, we can't run - * SendRowDescriptionMessage(), because that needs catalog accesses. - * (We can't do RevalidateCachedPlan, either, but that's a lesser problem.) + * SendRowDescriptionMessage(), because that needs catalog accesses. (We + * can't do RevalidateCachedPlan, either, but that's a lesser problem.) * Hence, refuse to Describe statements that return data. (We shouldn't * just refuse all Describes, since that might break the ability of some * clients to issue COMMIT or ROLLBACK commands, if they use code that @@ -2368,6 +2369,7 @@ drop_unnamed_stmt(void) if (unnamed_stmt_psrc) DropCachedPlan(unnamed_stmt_psrc); unnamed_stmt_psrc = NULL; + /* * If we failed while trying to build a prior unnamed statement, we may * have a memory context that wasn't assigned to a completed plancache @@ -2564,7 +2566,7 @@ ProcessInterrupts(void) else ereport(FATAL, (errcode(ERRCODE_ADMIN_SHUTDOWN), - errmsg("terminating connection due to administrator command"))); + errmsg("terminating connection due to administrator command"))); } if (QueryCancelPending) { @@ -2624,8 +2626,8 @@ check_stack_depth(void) ereport(ERROR, (errcode(ERRCODE_STATEMENT_TOO_COMPLEX), errmsg("stack depth limit exceeded"), - errhint("Increase the configuration parameter \"max_stack_depth\", " - "after ensuring the platform's stack depth limit is adequate."))); + errhint("Increase the configuration parameter \"max_stack_depth\", " + "after ensuring the platform's stack depth limit is adequate."))); } } @@ -2852,9 +2854,9 @@ PostgresMain(int argc, char *argv[], const char *username) gucsource = PGC_S_ARGV; /* initial switches came from command line */ /* - * Parse command-line options. CAUTION: keep this in sync with - * postmaster/postmaster.c (the option sets should not conflict) - * and with the common help() function in main/main.c. + * Parse command-line options. CAUTION: keep this in sync with + * postmaster/postmaster.c (the option sets should not conflict) and with + * the common help() function in main/main.c. */ while ((flag = getopt(argc, argv, "A:B:c:D:d:EeFf:h:ijk:lN:nOo:Pp:r:S:sTt:v:W:y:-:")) != -1) { @@ -3119,7 +3121,7 @@ PostgresMain(int argc, char *argv[], const char *username) if (IsUnderPostmaster) pqsignal(SIGQUIT, quickdie); /* hard crash time */ else - pqsignal(SIGQUIT, die); /* cancel current query and exit */ + pqsignal(SIGQUIT, die); /* cancel current query and exit */ pqsignal(SIGALRM, handle_sig_alarm); /* timeout conditions */ /* @@ -3787,11 +3789,11 @@ get_stack_depth_rlimit(void) val = rlim.rlim_cur; } return val; -#else /* no getrlimit */ +#else /* no getrlimit */ #if defined(WIN32) || defined(__CYGWIN__) /* On Windows we set the backend stack size in src/backend/Makefile */ return WIN32_STACK_RLIMIT; -#else /* not windows ... give up */ +#else /* not windows ... give up */ return -1; #endif #endif diff --git a/src/backend/tcop/pquery.c b/src/backend/tcop/pquery.c index 15b2cd4c2cf..72d20cd3ca8 100644 --- a/src/backend/tcop/pquery.c +++ b/src/backend/tcop/pquery.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/tcop/pquery.c,v 1.117 2007/09/03 18:46:30 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/tcop/pquery.c,v 1.118 2007/11/15 21:14:38 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -32,7 +32,7 @@ Portal ActivePortal = NULL; -static void ProcessQuery(PlannedStmt *plan, +static void ProcessQuery(PlannedStmt * plan, ParamListInfo params, DestReceiver *dest, char *completionTag); @@ -57,7 +57,7 @@ static void DoPortalRewind(Portal portal); * CreateQueryDesc */ QueryDesc * -CreateQueryDesc(PlannedStmt *plannedstmt, +CreateQueryDesc(PlannedStmt * plannedstmt, Snapshot snapshot, Snapshot crosscheck_snapshot, DestReceiver *dest, @@ -67,9 +67,9 @@ CreateQueryDesc(PlannedStmt *plannedstmt, QueryDesc *qd = (QueryDesc *) palloc(sizeof(QueryDesc)); qd->operation = plannedstmt->commandType; /* operation */ - qd->plannedstmt = plannedstmt; /* plan */ - qd->utilitystmt = plannedstmt->utilityStmt; /* in case DECLARE CURSOR */ - qd->snapshot = snapshot; /* snapshot */ + qd->plannedstmt = plannedstmt; /* plan */ + qd->utilitystmt = plannedstmt->utilityStmt; /* in case DECLARE CURSOR */ + qd->snapshot = snapshot; /* snapshot */ qd->crosscheck_snapshot = crosscheck_snapshot; /* RI check snapshot */ qd->dest = dest; /* output dest */ qd->params = params; /* parameter values passed into query */ @@ -94,10 +94,10 @@ CreateUtilityQueryDesc(Node *utilitystmt, { QueryDesc *qd = (QueryDesc *) palloc(sizeof(QueryDesc)); - qd->operation = CMD_UTILITY; /* operation */ + qd->operation = CMD_UTILITY; /* operation */ qd->plannedstmt = NULL; - qd->utilitystmt = utilitystmt; /* utility command */ - qd->snapshot = snapshot; /* snapshot */ + qd->utilitystmt = utilitystmt; /* utility command */ + qd->snapshot = snapshot; /* snapshot */ qd->crosscheck_snapshot = InvalidSnapshot; /* RI check snapshot */ qd->dest = dest; /* output dest */ qd->params = params; /* parameter values passed into query */ @@ -141,7 +141,7 @@ FreeQueryDesc(QueryDesc *qdesc) * error; otherwise the executor's memory usage will be leaked. */ static void -ProcessQuery(PlannedStmt *plan, +ProcessQuery(PlannedStmt * plan, ParamListInfo params, DestReceiver *dest, char *completionTag) @@ -579,7 +579,7 @@ PortalStart(Portal portal, ParamListInfo params, Snapshot snapshot) * take care of it if needed. */ { - Node *ustmt = PortalGetPrimaryStmt(portal); + Node *ustmt = PortalGetPrimaryStmt(portal); Assert(!IsA(ustmt, PlannedStmt)); portal->tupDesc = UtilityTupleDescriptor(ustmt); @@ -1218,7 +1218,7 @@ PortalRunMulti(Portal portal, bool isTopLevel, */ foreach(stmtlist_item, portal->stmts) { - Node *stmt = (Node *) lfirst(stmtlist_item); + Node *stmt = (Node *) lfirst(stmtlist_item); /* * If we got a cancel signal in prior command, quit @@ -1366,7 +1366,7 @@ PortalRunFetch(Portal portal, * results in the portal's tuplestore. */ if (!portal->holdStore) - FillPortalStore(portal, false /* isTopLevel */); + FillPortalStore(portal, false /* isTopLevel */ ); /* * Now fetch desired portion of results. diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c index d0b23d8d292..9a1e877820d 100644 --- a/src/backend/tcop/utility.c +++ b/src/backend/tcop/utility.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/tcop/utility.c,v 1.286 2007/09/03 18:46:30 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/tcop/utility.c,v 1.287 2007/11/15 21:14:38 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -269,9 +269,9 @@ CommandIsReadOnly(Node *parsetree) { case CMD_SELECT: if (stmt->intoClause != NULL) - return false; /* SELECT INTO */ + return false; /* SELECT INTO */ else if (stmt->rowMarks != NIL) - return false; /* SELECT FOR UPDATE/SHARE */ + return false; /* SELECT FOR UPDATE/SHARE */ else return true; case CMD_UPDATE: @@ -546,8 +546,8 @@ ProcessUtility(Node *parsetree, case T_CreateStmt: { - List *stmts; - ListCell *l; + List *stmts; + ListCell *l; Oid relOid; /* Run parse analysis ... */ @@ -557,7 +557,7 @@ ProcessUtility(Node *parsetree, /* ... and do it */ foreach(l, stmts) { - Node *stmt = (Node *) lfirst(l); + Node *stmt = (Node *) lfirst(l); if (IsA(stmt, CreateStmt)) { @@ -746,8 +746,8 @@ ProcessUtility(Node *parsetree, case T_AlterTableStmt: { - List *stmts; - ListCell *l; + List *stmts; + ListCell *l; /* Run parse analysis ... */ stmts = transformAlterTableStmt((AlterTableStmt *) parsetree, @@ -756,7 +756,7 @@ ProcessUtility(Node *parsetree, /* ... and do it */ foreach(l, stmts) { - Node *stmt = (Node *) lfirst(l); + Node *stmt = (Node *) lfirst(l); if (IsA(stmt, AlterTableStmt)) { @@ -886,11 +886,11 @@ ProcessUtility(Node *parsetree, } break; - case T_CreateEnumStmt: /* CREATE TYPE (enum) */ + case T_CreateEnumStmt: /* CREATE TYPE (enum) */ DefineEnum((CreateEnumStmt *) parsetree); break; - case T_ViewStmt: /* CREATE VIEW */ + case T_ViewStmt: /* CREATE VIEW */ DefineView((ViewStmt *) parsetree, queryString); break; @@ -1158,11 +1158,12 @@ ProcessUtility(Node *parsetree, ReindexTable(stmt->relation); break; case OBJECT_DATABASE: + /* - * This cannot run inside a user transaction block; - * if we were inside a transaction, then its commit- - * and start-transaction-command calls would not have - * the intended effect! + * This cannot run inside a user transaction block; if + * we were inside a transaction, then its commit- and + * start-transaction-command calls would not have the + * intended effect! */ PreventTransactionChain(isTopLevel, "REINDEX DATABASE"); @@ -1385,7 +1386,7 @@ CreateCommandTag(Node *parsetree) switch (nodeTag(parsetree)) { - /* raw plannable queries */ + /* raw plannable queries */ case T_InsertStmt: tag = "INSERT"; break; @@ -1402,7 +1403,7 @@ CreateCommandTag(Node *parsetree) tag = "SELECT"; break; - /* utility statements --- same whether raw or cooked */ + /* utility statements --- same whether raw or cooked */ case T_TransactionStmt: { TransactionStmt *stmt = (TransactionStmt *) parsetree; @@ -1460,6 +1461,7 @@ CreateCommandTag(Node *parsetree) case T_ClosePortalStmt: { ClosePortalStmt *stmt = (ClosePortalStmt *) parsetree; + if (stmt->portalname == NULL) tag = "CLOSE CURSOR ALL"; else @@ -1714,8 +1716,8 @@ CreateCommandTag(Node *parsetree) /* * We might be supporting ALTER INDEX here, so set the - * completion tag appropriately. Catch all other - * possibilities with ALTER TABLE + * completion tag appropriately. Catch all other possibilities + * with ALTER TABLE */ if (stmt->relkind == OBJECT_INDEX) @@ -2030,6 +2032,7 @@ CreateCommandTag(Node *parsetree) case T_DeallocateStmt: { DeallocateStmt *stmt = (DeallocateStmt *) parsetree; + if (stmt->name == NULL) tag = "DEALLOCATE ALL"; else @@ -2037,7 +2040,7 @@ CreateCommandTag(Node *parsetree) } break; - /* already-planned queries */ + /* already-planned queries */ case T_PlannedStmt: { PlannedStmt *stmt = (PlannedStmt *) parsetree; @@ -2045,6 +2048,7 @@ CreateCommandTag(Node *parsetree) switch (stmt->commandType) { case CMD_SELECT: + /* * We take a little extra care here so that the result * will be useful for complaints about read-only @@ -2085,14 +2089,15 @@ CreateCommandTag(Node *parsetree) } break; - /* parsed-and-rewritten-but-not-planned queries */ + /* parsed-and-rewritten-but-not-planned queries */ case T_Query: { - Query *stmt = (Query *) parsetree; + Query *stmt = (Query *) parsetree; switch (stmt->commandType) { case CMD_SELECT: + /* * We take a little extra care here so that the result * will be useful for complaints about read-only @@ -2162,7 +2167,7 @@ GetCommandLogLevel(Node *parsetree) switch (nodeTag(parsetree)) { - /* raw plannable queries */ + /* raw plannable queries */ case T_InsertStmt: case T_DeleteStmt: case T_UpdateStmt: @@ -2176,7 +2181,7 @@ GetCommandLogLevel(Node *parsetree) lev = LOGSTMT_ALL; break; - /* utility statements --- same whether raw or cooked */ + /* utility statements --- same whether raw or cooked */ case T_TransactionStmt: lev = LOGSTMT_ALL; break; @@ -2487,7 +2492,7 @@ GetCommandLogLevel(Node *parsetree) lev = LOGSTMT_ALL; break; - /* already-planned queries */ + /* already-planned queries */ case T_PlannedStmt: { PlannedStmt *stmt = (PlannedStmt *) parsetree; @@ -2516,10 +2521,10 @@ GetCommandLogLevel(Node *parsetree) } break; - /* parsed-and-rewritten-but-not-planned queries */ + /* parsed-and-rewritten-but-not-planned queries */ case T_Query: { - Query *stmt = (Query *) parsetree; + Query *stmt = (Query *) parsetree; switch (stmt->commandType) { |