diff options
| author | Bruce Momjian | 2006-10-04 00:30:14 +0000 |
|---|---|---|
| committer | Bruce Momjian | 2006-10-04 00:30:14 +0000 |
| commit | f99a569a2ee3763b4ae174e81250c95ca0fdcbb6 (patch) | |
| tree | 76e6371fe8b347c73d7020c0bc54b9fba519dc10 /src/backend/tcop | |
| parent | 451e419e9852cdf9d7e7cefc09d5355abb3405e9 (diff) | |
pgindent run for 8.2.
Diffstat (limited to 'src/backend/tcop')
| -rw-r--r-- | src/backend/tcop/fastpath.c | 16 | ||||
| -rw-r--r-- | src/backend/tcop/postgres.c | 112 | ||||
| -rw-r--r-- | src/backend/tcop/pquery.c | 35 | ||||
| -rw-r--r-- | src/backend/tcop/utility.c | 33 |
4 files changed, 101 insertions, 95 deletions
diff --git a/src/backend/tcop/fastpath.c b/src/backend/tcop/fastpath.c index 26931e0a6d7..8a9d51a5516 100644 --- a/src/backend/tcop/fastpath.c +++ b/src/backend/tcop/fastpath.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/tcop/fastpath.c,v 1.92 2006/09/08 15:55:53 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/tcop/fastpath.c,v 1.93 2006/10/04 00:29:58 momjian Exp $ * * NOTES * This cruft is the server side of PQfn. @@ -303,8 +303,8 @@ HandleFunctionRequest(StringInfo msgBuf) "commands ignored until end of transaction block"))); /* - * Now that we know we are in a valid transaction, set snapshot in - * case needed by function itself or one of the datatype I/O routines. + * Now that we know we are in a valid transaction, set snapshot in case + * needed by function itself or one of the datatype I/O routines. */ ActiveSnapshot = CopySnapshot(GetTransactionSnapshot()); @@ -312,7 +312,7 @@ HandleFunctionRequest(StringInfo msgBuf) * Begin parsing the buffer contents. */ if (PG_PROTOCOL_MAJOR(FrontendProtocol) < 3) - (void) pq_getmsgstring(msgBuf); /* dummy string */ + (void) pq_getmsgstring(msgBuf); /* dummy string */ fid = (Oid) pq_getmsgint(msgBuf, 4); /* function oid */ @@ -474,8 +474,8 @@ parse_fcall_arguments(StringInfo msgBuf, struct fp_info * fip, if (argsize < 0) ereport(ERROR, (errcode(ERRCODE_PROTOCOL_VIOLATION), - errmsg("invalid argument size %d in function call message", - argsize))); + errmsg("invalid argument size %d in function call message", + argsize))); /* Reset abuf to empty, and insert raw data into it */ abuf.len = 0; @@ -607,8 +607,8 @@ parse_fcall_arguments_20(StringInfo msgBuf, struct fp_info * fip, if (argsize < 0) ereport(ERROR, (errcode(ERRCODE_PROTOCOL_VIOLATION), - errmsg("invalid argument size %d in function call message", - argsize))); + errmsg("invalid argument size %d in function call message", + argsize))); /* Reset abuf to empty, and insert raw data into it */ abuf.len = 0; diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 6e83a23293d..835b5ab36ea 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.509 2006/09/13 21:59:04 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.510 2006/10/04 00:29:58 momjian Exp $ * * NOTES * this is the "main" module of the postgres backend and @@ -1340,8 +1340,8 @@ exec_bind_message(StringInfo input_message) numPFormats = pq_getmsgint(input_message, 2); if (numPFormats > 0) { - int i; - + int i; + pformats = (int16 *) palloc(numPFormats * sizeof(int16)); for (i = 0; i < numPFormats; i++) pformats[i] = pq_getmsgint(input_message, 2); @@ -1400,7 +1400,7 @@ exec_bind_message(StringInfo input_message) /* sizeof(ParamListInfoData) includes the first array element */ params = (ParamListInfo) palloc(sizeof(ParamListInfoData) + - (numParams - 1) * sizeof(ParamExternData)); + (numParams - 1) *sizeof(ParamExternData)); params->numParams = numParams; paramno = 0; @@ -1473,7 +1473,7 @@ exec_bind_message(StringInfo input_message) if (pstring && pstring != pbuf.data) pfree(pstring); } - else if (pformat == 1) /* binary mode */ + else if (pformat == 1) /* binary mode */ { Oid typreceive; Oid typioparam; @@ -1513,6 +1513,7 @@ exec_bind_message(StringInfo input_message) params->params[paramno].value = pval; params->params[paramno].isnull = isNull; + /* * We mark the params as CONST. This has no effect if we already * did planning, but if we didn't, it licenses the planner to @@ -1534,7 +1535,7 @@ exec_bind_message(StringInfo input_message) numRFormats = pq_getmsgint(input_message, 2); if (numRFormats > 0) { - int i; + int i; rformats = (int16 *) palloc(numRFormats * sizeof(int16)); for (i = 0; i < numRFormats; i++) @@ -1548,14 +1549,14 @@ exec_bind_message(StringInfo input_message) * to make use of the concrete parameter values we now have. Because we * use PARAM_FLAG_CONST, the plan is good only for this set of param * values, and so we generate the plan in the portal's own memory context - * where it will be thrown away after use. As in exec_parse_message, - * we make no attempt to recover planner temporary memory until the end - * of the operation. + * where it will be thrown away after use. As in exec_parse_message, we + * make no attempt to recover planner temporary memory until the end of + * the operation. * - * XXX because the planner has a bad habit of scribbling on its input, - * we have to make a copy of the parse trees, just in case someone binds - * and executes an unnamed statement multiple times; this also means that - * the portal's queryContext becomes its own heap context rather than the + * XXX because the planner has a bad habit of scribbling on its input, we + * have to make a copy of the parse trees, just in case someone binds and + * executes an unnamed statement multiple times; this also means that the + * portal's queryContext becomes its own heap context rather than the * prepared statement's context. FIXME someday */ if (pstmt->plan_list == NIL && pstmt->query_list != NIL) @@ -1694,9 +1695,9 @@ exec_execute_message(const char *portal_name, long max_rows) execute_is_fetch = !portal->atStart; /* - * We must copy the sourceText and prepStmtName into MessageContext - * in case the portal is destroyed during finish_xact_command. - * Can avoid the copy if it's not an xact command, though. + * We must copy the sourceText and prepStmtName into MessageContext in + * case the portal is destroyed during finish_xact_command. Can avoid the + * copy if it's not an xact command, though. */ if (is_xact_command) { @@ -1705,6 +1706,7 @@ exec_execute_message(const char *portal_name, long max_rows) prepStmtName = pstrdup(portal->prepStmtName); else prepStmtName = "<unnamed>"; + /* * An xact command shouldn't have any parameters, which is a good * thing because they wouldn't be around after finish_xact_command. @@ -1925,10 +1927,9 @@ check_log_duration(char *msec_str, bool was_logged) msecs = usecs / 1000; /* - * This odd-looking test for log_min_duration_statement being - * exceeded is designed to avoid integer overflow with very - * long durations: don't compute secs * 1000 until we've - * verified it will fit in int. + * This odd-looking test for log_min_duration_statement being exceeded + * is designed to avoid integer overflow with very long durations: + * don't compute secs * 1000 until we've verified it will fit in int. */ exceeded = (log_min_duration_statement == 0 || (log_min_duration_statement > 0 && @@ -2026,7 +2027,7 @@ errdetail_params(ParamListInfo params) appendStringInfoCharMacro(¶m_str, '\''); for (p = pstring; *p; p++) { - if (*p == '\'') /* double single quotes */ + if (*p == '\'') /* double single quotes */ appendStringInfoCharMacro(¶m_str, *p); appendStringInfoCharMacro(¶m_str, *p); } @@ -2082,7 +2083,7 @@ exec_describe_statement_message(const char *stmt_name) /* * If we are in aborted transaction state, we can't safely create a result - * tupledesc, because that needs catalog accesses. Hence, refuse to + * tupledesc, because that needs catalog accesses. 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 blindly Describes @@ -2154,7 +2155,7 @@ exec_describe_portal_message(const char *portal_name) /* * If we are in aborted transaction state, we can't run * SendRowDescriptionMessage(), because that needs catalog accesses. - * Hence, refuse to Describe portals that return data. (We shouldn't just + * Hence, refuse to Describe portals 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 * blindly Describes whatever it does.) @@ -2581,29 +2582,29 @@ set_debug_options(int debug_flag, GucContext context, GucSource source) bool set_plan_disabling_options(const char *arg, GucContext context, GucSource source) { - char *tmp = NULL; + char *tmp = NULL; switch (arg[0]) { - case 's': /* seqscan */ + case 's': /* seqscan */ tmp = "enable_seqscan"; break; - case 'i': /* indexscan */ + case 'i': /* indexscan */ tmp = "enable_indexscan"; break; - case 'b': /* bitmapscan */ + case 'b': /* bitmapscan */ tmp = "enable_bitmapscan"; break; - case 't': /* tidscan */ + case 't': /* tidscan */ tmp = "enable_tidscan"; break; - case 'n': /* nestloop */ + case 'n': /* nestloop */ tmp = "enable_nestloop"; break; - case 'm': /* mergejoin */ + case 'm': /* mergejoin */ tmp = "enable_mergejoin"; break; - case 'h': /* hashjoin */ + case 'h': /* hashjoin */ tmp = "enable_hashjoin"; break; } @@ -2623,13 +2624,13 @@ get_stats_option_name(const char *arg) switch (arg[0]) { case 'p': - if (optarg[1] == 'a') /* "parser" */ + if (optarg[1] == 'a') /* "parser" */ return "log_parser_stats"; - else if (optarg[1] == 'l') /* "planner" */ + else if (optarg[1] == 'l') /* "planner" */ return "log_planner_stats"; break; - case 'e': /* "executor" */ + case 'e': /* "executor" */ return "log_executor_stats"; break; } @@ -2834,6 +2835,7 @@ PostgresMain(int argc, char *argv[], const char *username) break; case 's': + /* * Since log options are SUSET, we need to postpone unless * still in secure context @@ -2850,19 +2852,20 @@ PostgresMain(int argc, char *argv[], const char *username) break; case 't': - { - const char *tmp = get_stats_option_name(optarg); - if (tmp) { - if (ctx == PGC_BACKEND) - PendingConfigOption(tmp, "true"); + const char *tmp = get_stats_option_name(optarg); + + if (tmp) + { + if (ctx == PGC_BACKEND) + PendingConfigOption(tmp, "true"); + else + SetConfigOption(tmp, "true", ctx, gucsource); + } else - SetConfigOption(tmp, "true", ctx, gucsource); + errs++; + break; } - else - errs++; - break; - } case 'v': if (secure) @@ -2875,6 +2878,7 @@ PostgresMain(int argc, char *argv[], const char *username) case 'y': + /* * y - special flag passed if backend was forked by a * postmaster. @@ -3090,10 +3094,10 @@ PostgresMain(int argc, char *argv[], const char *username) } /* - * Create a per-backend PGPROC struct in shared memory, except in - * the EXEC_BACKEND case where this was done in SubPostmasterMain. - * We must do this before we can use LWLocks (and in the EXEC_BACKEND - * case we already had to do some stuff with LWLocks). + * Create a per-backend PGPROC struct in shared memory, except in the + * EXEC_BACKEND case where this was done in SubPostmasterMain. We must do + * this before we can use LWLocks (and in the EXEC_BACKEND case we already + * had to do some stuff with LWLocks). */ #ifdef EXEC_BACKEND if (!IsUnderPostmaster) @@ -3154,8 +3158,8 @@ PostgresMain(int argc, char *argv[], const char *username) on_proc_exit(log_disconnections, 0); /* - * process any libraries that should be preloaded at backend start - * (this likewise can't be done until GUC settings are complete) + * process any libraries that should be preloaded at backend start (this + * likewise can't be done until GUC settings are complete) */ process_local_preload_libraries(); @@ -3290,7 +3294,7 @@ PostgresMain(int argc, char *argv[], const char *username) PG_SETMASK(&UnBlockSig); if (!ignore_till_sync) - send_ready_for_query = true; /* initially, or after error */ + send_ready_for_query = true; /* initially, or after error */ /* * Non-error queries loop here. @@ -3465,8 +3469,8 @@ PostgresMain(int argc, char *argv[], const char *username) /* * Note: we may at this point be inside an aborted - * transaction. We can't throw error for that until - * we've finished reading the function-call message, so + * transaction. We can't throw error for that until we've + * finished reading the function-call message, so * HandleFunctionRequest() must check for it after doing so. * Be careful not to do anything that assumes we're inside a * valid transaction here. @@ -3778,5 +3782,5 @@ log_disconnections(int code, Datum arg) "user=%s database=%s host=%s%s%s", hours, minutes, seconds, msecs, port->user_name, port->database_name, port->remote_host, - port->remote_port[0] ? " port=" : "", port->remote_port))); + port->remote_port[0] ? " port=" : "", port->remote_port))); } diff --git a/src/backend/tcop/pquery.c b/src/backend/tcop/pquery.c index 8738d91abdf..62310f7c0cd 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.110 2006/09/03 03:19:45 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/tcop/pquery.c,v 1.111 2006/10/04 00:29:58 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -218,8 +218,8 @@ ChoosePortalStrategy(List *parseTrees) /* * PORTAL_ONE_SELECT and PORTAL_UTIL_SELECT need only consider the - * single-Query-struct case, since there are no rewrite rules that - * can add auxiliary queries to a SELECT or a utility command. + * single-Query-struct case, since there are no rewrite rules that can add + * auxiliary queries to a SELECT or a utility command. */ if (list_length(parseTrees) == 1) { @@ -244,8 +244,8 @@ ChoosePortalStrategy(List *parseTrees) /* * PORTAL_ONE_RETURNING has to allow auxiliary queries added by rewrite. - * Choose PORTAL_ONE_RETURNING if there is exactly one canSetTag query - * and it has a RETURNING list. + * Choose PORTAL_ONE_RETURNING if there is exactly one canSetTag query and + * it has a RETURNING list. */ nSetTag = 0; foreach(lc, parseTrees) @@ -256,9 +256,9 @@ ChoosePortalStrategy(List *parseTrees) if (query->canSetTag) { if (++nSetTag > 1) - return PORTAL_MULTI_QUERY; /* no need to look further */ + return PORTAL_MULTI_QUERY; /* no need to look further */ if (query->returningList == NIL) - return PORTAL_MULTI_QUERY; /* no need to look further */ + return PORTAL_MULTI_QUERY; /* no need to look further */ } } if (nSetTag == 1) @@ -418,7 +418,7 @@ PortalStart(Portal portal, ParamListInfo params, Snapshot snapshot) if (portal->cursorOptions & CURSOR_OPT_SCROLL) eflags = EXEC_FLAG_REWIND | EXEC_FLAG_BACKWARD; else - eflags = 0; /* default run-to-completion flags */ + eflags = 0; /* default run-to-completion flags */ /* * Call ExecutorStart to prepare the plan for execution @@ -447,8 +447,8 @@ PortalStart(Portal portal, ParamListInfo params, Snapshot snapshot) case PORTAL_ONE_RETURNING: /* - * We don't start the executor until we are told to run - * the portal. We do need to set up the result tupdesc. + * We don't start the executor until we are told to run the + * portal. We do need to set up the result tupdesc. */ portal->tupDesc = ExecCleanTypeFromTL((PortalGetPrimaryQuery(portal))->returningList, false); @@ -672,8 +672,8 @@ PortalRun(Portal portal, long count, case PORTAL_UTIL_SELECT: /* - * If we have not yet run the command, do so, - * storing its results in the portal's tuplestore. + * If we have not yet run the command, do so, storing its + * results in the portal's tuplestore. */ if (!portal->holdStore) FillPortalStore(portal); @@ -922,10 +922,11 @@ FillPortalStore(Portal portal) switch (portal->strategy) { case PORTAL_ONE_RETURNING: + /* - * Run the portal to completion just as for the default MULTI_QUERY - * case, but send the primary query's output to the tuplestore. - * Auxiliary query outputs are discarded. + * Run the portal to completion just as for the default + * MULTI_QUERY case, but send the primary query's output to the + * tuplestore. Auxiliary query outputs are discarded. */ PortalRunMulti(portal, treceiver, None_Receiver, completionTag); /* Override default completion tag with actual command result */ @@ -1253,8 +1254,8 @@ PortalRunFetch(Portal portal, case PORTAL_UTIL_SELECT: /* - * If we have not yet run the command, do so, - * storing its results in the portal's tuplestore. + * If we have not yet run the command, do so, storing its + * results in the portal's tuplestore. */ if (!portal->holdStore) FillPortalStore(portal); diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c index 868da2d5ff4..448b0fba02e 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.268 2006/09/07 22:52:01 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/tcop/utility.c,v 1.269 2006/10/04 00:29:58 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -632,7 +632,7 @@ ProcessUtility(Node *parsetree, case T_CopyStmt: { - uint64 processed = DoCopy((CopyStmt *) parsetree); + uint64 processed = DoCopy((CopyStmt *) parsetree); if (completionTag) snprintf(completionTag, COMPLETION_TAG_BUFSIZE, @@ -798,10 +798,10 @@ ProcessUtility(Node *parsetree, stmt->unique, stmt->primary, stmt->isconstraint, - false, /* is_alter_table */ - true, /* check_rights */ - false, /* skip_build */ - false, /* quiet */ + false, /* is_alter_table */ + true, /* check_rights */ + false, /* skip_build */ + false, /* quiet */ stmt->concurrent); /* concurrent */ } break; @@ -1883,7 +1883,7 @@ GetCommandLogLevel(Node *parsetree) case T_SelectStmt: if (((SelectStmt *) parsetree)->into) - lev = LOGSTMT_DDL; /* CREATE AS, SELECT INTO */ + lev = LOGSTMT_DDL; /* CREATE AS, SELECT INTO */ else lev = LOGSTMT_ALL; break; @@ -2053,7 +2053,7 @@ GetCommandLogLevel(Node *parsetree) case T_ExplainStmt: { - ExplainStmt *stmt = (ExplainStmt *) parsetree; + ExplainStmt *stmt = (ExplainStmt *) parsetree; /* Look through an EXPLAIN ANALYZE to the contained stmt */ if (stmt->analyze) @@ -2128,7 +2128,7 @@ GetCommandLogLevel(Node *parsetree) break; case T_ReindexStmt: - lev = LOGSTMT_ALL; /* should this be DDL? */ + lev = LOGSTMT_ALL; /* should this be DDL? */ break; case T_CreateConversionStmt: @@ -2153,7 +2153,7 @@ GetCommandLogLevel(Node *parsetree) case T_PrepareStmt: { - PrepareStmt *stmt = (PrepareStmt *) parsetree; + PrepareStmt *stmt = (PrepareStmt *) parsetree; /* Look through a PREPARE to the contained stmt */ return GetCommandLogLevel((Node *) stmt->query); @@ -2162,9 +2162,9 @@ GetCommandLogLevel(Node *parsetree) case T_ExecuteStmt: { - ExecuteStmt *stmt = (ExecuteStmt *) parsetree; + ExecuteStmt *stmt = (ExecuteStmt *) parsetree; PreparedStatement *pstmt; - ListCell *l; + ListCell *l; /* Look through an EXECUTE to the referenced stmt(s) */ lev = LOGSTMT_ALL; @@ -2173,7 +2173,7 @@ GetCommandLogLevel(Node *parsetree) { foreach(l, pstmt->query_list) { - Query *query = (Query *) lfirst(l); + Query *query = (Query *) lfirst(l); LogStmtLevel stmt_lev; stmt_lev = GetQueryLogLevel(query); @@ -2188,10 +2188,11 @@ GetCommandLogLevel(Node *parsetree) break; case T_Query: + /* * In complicated situations (eg, EXPLAIN ANALYZE in an extended - * Query protocol), we might find an already-analyzed query - * within a utility statement. Cope. + * Query protocol), we might find an already-analyzed query within + * a utility statement. Cope. */ lev = GetQueryLogLevel((Query *) parsetree); break; @@ -2224,7 +2225,7 @@ GetQueryLogLevel(Query *parsetree) { case CMD_SELECT: if (parsetree->into != NULL) - lev = LOGSTMT_DDL; /* CREATE AS, SELECT INTO */ + lev = LOGSTMT_DDL; /* CREATE AS, SELECT INTO */ else lev = LOGSTMT_ALL; break; |
