mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
Pgindent run for 8.0.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/tcop/fastpath.c,v 1.74 2004/08/29 04:12:50 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/tcop/fastpath.c,v 1.75 2004/08/29 05:06:49 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* This cruft is the server side of PQfn.
|
||||
@@ -157,7 +157,7 @@ SendFunctionResult(Datum retval, bool isnull, Oid rettype, int16 format)
|
||||
getTypeOutputInfo(rettype, &typoutput, &typioparam, &typisvarlena);
|
||||
outputstr = DatumGetCString(OidFunctionCall3(typoutput,
|
||||
retval,
|
||||
ObjectIdGetDatum(typioparam),
|
||||
ObjectIdGetDatum(typioparam),
|
||||
Int32GetDatum(-1)));
|
||||
pq_sendcountedtext(&buf, outputstr, strlen(outputstr), false);
|
||||
pfree(outputstr);
|
||||
@@ -173,7 +173,7 @@ SendFunctionResult(Datum retval, bool isnull, Oid rettype, int16 format)
|
||||
&typsend, &typioparam, &typisvarlena);
|
||||
outputbytes = DatumGetByteaP(OidFunctionCall2(typsend,
|
||||
retval,
|
||||
ObjectIdGetDatum(typioparam)));
|
||||
ObjectIdGetDatum(typioparam)));
|
||||
/* We assume the result will not have been toasted */
|
||||
pq_sendint(&buf, VARSIZE(outputbytes) - VARHDRSZ, 4);
|
||||
pq_sendbytes(&buf, VARDATA(outputbytes),
|
||||
@@ -302,7 +302,7 @@ HandleFunctionRequest(StringInfo msgBuf)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_IN_FAILED_SQL_TRANSACTION),
|
||||
errmsg("current transaction is aborted, "
|
||||
"commands ignored until end of transaction block")));
|
||||
"commands ignored until end of transaction block")));
|
||||
|
||||
/*
|
||||
* Begin parsing the buffer contents.
|
||||
@@ -501,7 +501,7 @@ parse_fcall_arguments(StringInfo msgBuf, struct fp_info * fip,
|
||||
|
||||
fcinfo->arg[i] = OidFunctionCall2(typreceive,
|
||||
PointerGetDatum(&abuf),
|
||||
ObjectIdGetDatum(typioparam));
|
||||
ObjectIdGetDatum(typioparam));
|
||||
|
||||
/* Trouble if it didn't eat the whole buffer */
|
||||
if (abuf.cursor != abuf.len)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.429 2004/08/29 04:12:50 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.430 2004/08/29 05:06:49 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* this is the "main" module of the postgres backend and
|
||||
@@ -77,7 +77,7 @@ const char *debug_query_string; /* for pgmonitor and
|
||||
CommandDest whereToSendOutput = Debug;
|
||||
|
||||
/* flag for logging end of session */
|
||||
bool Log_disconnections = false;
|
||||
bool Log_disconnections = false;
|
||||
|
||||
LogStmtLevel log_statement = LOGSTMT_NONE;
|
||||
|
||||
@@ -91,7 +91,7 @@ int max_stack_depth = 2048;
|
||||
*/
|
||||
|
||||
/* max_stack_depth converted to bytes for speed of checking */
|
||||
static int max_stack_depth_bytes = 2048*1024;
|
||||
static int max_stack_depth_bytes = 2048 * 1024;
|
||||
|
||||
/* stack base pointer (initialized by PostgresMain) */
|
||||
static char *stack_base_ptr = NULL;
|
||||
@@ -436,9 +436,9 @@ pg_parse_and_rewrite(const char *query_string, /* string to execute */
|
||||
Node *parsetree = (Node *) lfirst(list_item);
|
||||
|
||||
querytree_list = list_concat(querytree_list,
|
||||
pg_analyze_and_rewrite(parsetree,
|
||||
paramTypes,
|
||||
numParams));
|
||||
pg_analyze_and_rewrite(parsetree,
|
||||
paramTypes,
|
||||
numParams));
|
||||
}
|
||||
|
||||
return querytree_list;
|
||||
@@ -480,24 +480,24 @@ pg_parse_query(const char *query_string)
|
||||
{
|
||||
Node *parsetree = (Node *) lfirst(parsetree_item);
|
||||
const char *commandTag;
|
||||
|
||||
|
||||
if (IsA(parsetree, ExplainStmt) &&
|
||||
((ExplainStmt *)parsetree)->analyze)
|
||||
parsetree = (Node *)(((ExplainStmt *)parsetree)->query);
|
||||
|
||||
((ExplainStmt *) parsetree)->analyze)
|
||||
parsetree = (Node *) (((ExplainStmt *) parsetree)->query);
|
||||
|
||||
if (IsA(parsetree, PrepareStmt))
|
||||
parsetree = (Node *)(((PrepareStmt *)parsetree)->query);
|
||||
|
||||
parsetree = (Node *) (((PrepareStmt *) parsetree)->query);
|
||||
|
||||
if (IsA(parsetree, SelectStmt))
|
||||
continue; /* optimization for frequent command */
|
||||
|
||||
continue; /* optimization for frequent command */
|
||||
|
||||
if (log_statement == LOGSTMT_MOD &&
|
||||
(IsA(parsetree, InsertStmt) ||
|
||||
IsA(parsetree, UpdateStmt) ||
|
||||
IsA(parsetree, DeleteStmt) ||
|
||||
IsA(parsetree, TruncateStmt) ||
|
||||
(IsA(parsetree, CopyStmt) &&
|
||||
((CopyStmt *)parsetree)->is_from))) /* COPY FROM */
|
||||
((CopyStmt *) parsetree)->is_from))) /* COPY FROM */
|
||||
{
|
||||
ereport(LOG,
|
||||
(errmsg("statement: %s", query_string)));
|
||||
@@ -843,7 +843,7 @@ exec_simple_query(const char *query_string)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_IN_FAILED_SQL_TRANSACTION),
|
||||
errmsg("current transaction is aborted, "
|
||||
"commands ignored until end of transaction block")));
|
||||
"commands ignored until end of transaction block")));
|
||||
}
|
||||
|
||||
/* Make sure we are in a transaction command */
|
||||
@@ -1006,22 +1006,22 @@ exec_simple_query(const char *query_string)
|
||||
if (save_log_duration)
|
||||
ereport(LOG,
|
||||
(errmsg("duration: %ld.%03ld ms",
|
||||
(long) ((stop_t.tv_sec - start_t.tv_sec) * 1000 +
|
||||
(stop_t.tv_usec - start_t.tv_usec) / 1000),
|
||||
(long) (stop_t.tv_usec - start_t.tv_usec) % 1000)));
|
||||
(long) ((stop_t.tv_sec - start_t.tv_sec) * 1000 +
|
||||
(stop_t.tv_usec - start_t.tv_usec) / 1000),
|
||||
(long) (stop_t.tv_usec - start_t.tv_usec) % 1000)));
|
||||
|
||||
/*
|
||||
* Output a duration_statement to the log if the query has exceeded
|
||||
* the min duration, or if we are to print all durations.
|
||||
* Output a duration_statement to the log if the query has
|
||||
* exceeded the min duration, or if we are to print all durations.
|
||||
*/
|
||||
if (save_log_min_duration_statement == 0 ||
|
||||
(save_log_min_duration_statement > 0 &&
|
||||
usecs >= save_log_min_duration_statement * 1000))
|
||||
ereport(LOG,
|
||||
(errmsg("duration: %ld.%03ld ms statement: %s",
|
||||
(long) ((stop_t.tv_sec - start_t.tv_sec) * 1000 +
|
||||
(stop_t.tv_usec - start_t.tv_usec) / 1000),
|
||||
(long) (stop_t.tv_usec - start_t.tv_usec) % 1000,
|
||||
(long) ((stop_t.tv_sec - start_t.tv_sec) * 1000 +
|
||||
(stop_t.tv_usec - start_t.tv_usec) / 1000),
|
||||
(long) (stop_t.tv_usec - start_t.tv_usec) % 1000,
|
||||
query_string)));
|
||||
}
|
||||
|
||||
@@ -1164,7 +1164,7 @@ exec_parse_message(const char *query_string, /* string to execute */
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_IN_FAILED_SQL_TRANSACTION),
|
||||
errmsg("current transaction is aborted, "
|
||||
"commands ignored until end of transaction block")));
|
||||
"commands ignored until end of transaction block")));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1191,8 +1191,8 @@ exec_parse_message(const char *query_string, /* string to execute */
|
||||
if (ptype == InvalidOid || ptype == UNKNOWNOID)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INDETERMINATE_DATATYPE),
|
||||
errmsg("could not determine data type of parameter $%d",
|
||||
i + 1)));
|
||||
errmsg("could not determine data type of parameter $%d",
|
||||
i + 1)));
|
||||
param_list = lappend_oid(param_list, ptype);
|
||||
}
|
||||
|
||||
@@ -1349,7 +1349,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, list_length(pstmt->argtype_list))));
|
||||
numParams, stmt_name, list_length(pstmt->argtype_list))));
|
||||
|
||||
/*
|
||||
* Create the portal. Allow silent replacement of an existing portal
|
||||
@@ -1464,7 +1464,7 @@ exec_bind_message(StringInfo input_message)
|
||||
params[i].value =
|
||||
OidFunctionCall2(typreceive,
|
||||
PointerGetDatum(&pbuf),
|
||||
ObjectIdGetDatum(typioparam));
|
||||
ObjectIdGetDatum(typioparam));
|
||||
|
||||
/* Trouble if it didn't eat the whole buffer */
|
||||
if (pbuf.cursor != pbuf.len)
|
||||
@@ -1516,8 +1516,8 @@ exec_bind_message(StringInfo input_message)
|
||||
* If we didn't plan the query before, do it now. This allows the
|
||||
* planner to make use of the concrete parameter values we now have.
|
||||
*
|
||||
* This happens only for unnamed statements, and so switching into
|
||||
* the statement context for planning is correct (see notes in
|
||||
* This happens only for unnamed statements, and so switching into the
|
||||
* statement context for planning is correct (see notes in
|
||||
* exec_parse_message).
|
||||
*/
|
||||
if (pstmt->plan_list == NIL && pstmt->query_list != NIL &&
|
||||
@@ -1648,7 +1648,7 @@ exec_execute_message(const char *portal_name, long max_rows)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_IN_FAILED_SQL_TRANSACTION),
|
||||
errmsg("current transaction is aborted, "
|
||||
"commands ignored until end of transaction block")));
|
||||
"commands ignored until end of transaction block")));
|
||||
}
|
||||
|
||||
/* Check for cancel signal before we start execution */
|
||||
@@ -1874,11 +1874,11 @@ quickdie(SIGNAL_ARGS)
|
||||
*/
|
||||
ereport(WARNING,
|
||||
(errcode(ERRCODE_CRASH_SHUTDOWN),
|
||||
errmsg("terminating connection because of crash of another server process"),
|
||||
errdetail("The postmaster has commanded this server process to roll back"
|
||||
" the current transaction and exit, because another"
|
||||
" server process exited abnormally and possibly corrupted"
|
||||
" shared memory."),
|
||||
errmsg("terminating connection because of crash of another server process"),
|
||||
errdetail("The postmaster has commanded this server process to roll back"
|
||||
" the current transaction and exit, because another"
|
||||
" server process exited abnormally and possibly corrupted"
|
||||
" shared memory."),
|
||||
errhint("In a moment you should be able to reconnect to the"
|
||||
" database and repeat your command.")));
|
||||
|
||||
@@ -2061,29 +2061,32 @@ ProcessInterrupts(void)
|
||||
void
|
||||
check_stack_depth(void)
|
||||
{
|
||||
char stack_top_loc;
|
||||
int stack_depth;
|
||||
char stack_top_loc;
|
||||
int stack_depth;
|
||||
|
||||
/*
|
||||
* Compute distance from PostgresMain's local variables to my own
|
||||
*
|
||||
* Note: in theory stack_depth should be ptrdiff_t or some such, but
|
||||
* since the whole point of this code is to bound the value to something
|
||||
* much less than integer-sized, int should work fine.
|
||||
* since the whole point of this code is to bound the value to
|
||||
* something much less than integer-sized, int should work fine.
|
||||
*/
|
||||
stack_depth = (int) (stack_base_ptr - &stack_top_loc);
|
||||
|
||||
/*
|
||||
* Take abs value, since stacks grow up on some machines, down on others
|
||||
* Take abs value, since stacks grow up on some machines, down on
|
||||
* others
|
||||
*/
|
||||
if (stack_depth < 0)
|
||||
stack_depth = -stack_depth;
|
||||
|
||||
/*
|
||||
* Trouble?
|
||||
*
|
||||
* The test on stack_base_ptr prevents us from erroring out if called
|
||||
* during process setup or in a non-backend process. Logically it should
|
||||
* be done first, but putting it here avoids wasting cycles during normal
|
||||
* cases.
|
||||
* during process setup or in a non-backend process. Logically it
|
||||
* should be done first, but putting it here avoids wasting cycles
|
||||
* during normal cases.
|
||||
*/
|
||||
if (stack_depth > max_stack_depth_bytes &&
|
||||
stack_base_ptr != NULL)
|
||||
@@ -2166,10 +2169,10 @@ PostgresMain(int argc, char *argv[], const char *username)
|
||||
char *tmp;
|
||||
int firstchar;
|
||||
char stack_base;
|
||||
StringInfoData input_message;
|
||||
StringInfoData input_message;
|
||||
sigjmp_buf local_sigjmp_buf;
|
||||
volatile bool send_rfq = true;
|
||||
|
||||
|
||||
/*
|
||||
* Catch standard options before doing much else. This even works on
|
||||
* systems without getopt_long.
|
||||
@@ -2216,7 +2219,7 @@ PostgresMain(int argc, char *argv[], const char *username)
|
||||
elog(FATAL, "%s: could not locate my own executable path",
|
||||
argv[0]);
|
||||
}
|
||||
|
||||
|
||||
if (pkglib_path[0] == '\0')
|
||||
get_pkglib_path(my_exec_path, pkglib_path);
|
||||
|
||||
@@ -2395,9 +2398,9 @@ PostgresMain(int argc, char *argv[], const char *username)
|
||||
/*
|
||||
* ignore system indexes
|
||||
*
|
||||
* As of PG 7.4 this is safe to allow from the client,
|
||||
* since it only disables reading the system indexes,
|
||||
* not writing them. Worst case consequence is slowness.
|
||||
* As of PG 7.4 this is safe to allow from the client, since
|
||||
* it only disables reading the system indexes, not
|
||||
* writing them. Worst case consequence is slowness.
|
||||
*/
|
||||
IgnoreSystemIndexes(true);
|
||||
break;
|
||||
@@ -2412,6 +2415,7 @@ PostgresMain(int argc, char *argv[], const char *username)
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
|
||||
/*
|
||||
* p - special flag passed if backend was forked by a
|
||||
* postmaster.
|
||||
@@ -2486,7 +2490,7 @@ PostgresMain(int argc, char *argv[], const char *username)
|
||||
/*
|
||||
* wait N seconds to allow attach from a debugger
|
||||
*/
|
||||
pg_usleep(atoi(optarg)*1000000L);
|
||||
pg_usleep(atoi(optarg) * 1000000L);
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
@@ -2551,8 +2555,8 @@ PostgresMain(int argc, char *argv[], const char *username)
|
||||
|
||||
while (gucopts)
|
||||
{
|
||||
char *name;
|
||||
char *value;
|
||||
char *name;
|
||||
char *value;
|
||||
|
||||
name = lfirst(gucopts);
|
||||
gucopts = lnext(gucopts);
|
||||
@@ -2651,8 +2655,8 @@ PostgresMain(int argc, char *argv[], const char *username)
|
||||
{
|
||||
ereport(FATAL,
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
errmsg("invalid command-line arguments for server process"),
|
||||
errhint("Try \"%s --help\" for more information.", argv[0])));
|
||||
errmsg("invalid command-line arguments for server process"),
|
||||
errhint("Try \"%s --help\" for more information.", argv[0])));
|
||||
}
|
||||
|
||||
XLOGPathInit();
|
||||
@@ -2668,7 +2672,7 @@ PostgresMain(int argc, char *argv[], const char *username)
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
errmsg("%s: invalid command-line arguments",
|
||||
argv[0]),
|
||||
errhint("Try \"%s --help\" for more information.", argv[0])));
|
||||
errhint("Try \"%s --help\" for more information.", argv[0])));
|
||||
}
|
||||
else if (argc - optind == 1)
|
||||
dbname = argv[optind];
|
||||
@@ -2766,13 +2770,13 @@ PostgresMain(int argc, char *argv[], const char *username)
|
||||
* If an exception is encountered, processing resumes here so we abort
|
||||
* the current transaction and start a new one.
|
||||
*
|
||||
* You might wonder why this isn't coded as an infinite loop around
|
||||
* a PG_TRY construct. The reason is that this is the bottom of the
|
||||
* You might wonder why this isn't coded as an infinite loop around a
|
||||
* PG_TRY construct. The reason is that this is the bottom of the
|
||||
* exception stack, and so with PG_TRY there would be no exception
|
||||
* handler in force at all during the CATCH part. By leaving the
|
||||
* outermost setjmp always active, we have at least some chance of
|
||||
* recovering from an error during error recovery. (If we get into
|
||||
* an infinite loop thereby, it will soon be stopped by overflow of
|
||||
* recovering from an error during error recovery. (If we get into an
|
||||
* infinite loop thereby, it will soon be stopped by overflow of
|
||||
* elog.c's internal state stack.)
|
||||
*/
|
||||
|
||||
@@ -2781,9 +2785,10 @@ PostgresMain(int argc, char *argv[], const char *username)
|
||||
/*
|
||||
* NOTE: if you are tempted to add more code in this if-block,
|
||||
* consider the high probability that it should be in
|
||||
* AbortTransaction() instead. The only stuff done directly here
|
||||
* should be stuff that is guaranteed to apply *only* for outer-level
|
||||
* error recovery, such as adjusting the FE/BE protocol status.
|
||||
* AbortTransaction() instead. The only stuff done directly here
|
||||
* should be stuff that is guaranteed to apply *only* for
|
||||
* outer-level error recovery, such as adjusting the FE/BE
|
||||
* protocol status.
|
||||
*/
|
||||
|
||||
/* Since not using PG_TRY, must reset error stack by hand */
|
||||
@@ -2794,16 +2799,17 @@ PostgresMain(int argc, char *argv[], const char *username)
|
||||
|
||||
/*
|
||||
* Forget any pending QueryCancel request, since we're returning
|
||||
* to the idle loop anyway, and cancel the statement timer if running.
|
||||
* to the idle loop anyway, and cancel the statement timer if
|
||||
* running.
|
||||
*/
|
||||
QueryCancelPending = false;
|
||||
disable_sig_alarm(true);
|
||||
QueryCancelPending = false; /* again in case timeout occurred */
|
||||
|
||||
/*
|
||||
* Turn off these interrupts too. This is only needed here and not
|
||||
* in other exception-catching places since these interrupts are
|
||||
* only enabled while we wait for client input.
|
||||
* Turn off these interrupts too. This is only needed here and
|
||||
* not in other exception-catching places since these interrupts
|
||||
* are only enabled while we wait for client input.
|
||||
*/
|
||||
DisableNotifyInterrupt();
|
||||
DisableCatchupInterrupt();
|
||||
@@ -2812,8 +2818,8 @@ PostgresMain(int argc, char *argv[], const char *username)
|
||||
EmitErrorReport();
|
||||
|
||||
/*
|
||||
* Make sure debug_query_string gets reset before we possibly clobber
|
||||
* the storage it points at.
|
||||
* Make sure debug_query_string gets reset before we possibly
|
||||
* clobber the storage it points at.
|
||||
*/
|
||||
debug_query_string = NULL;
|
||||
|
||||
@@ -2882,8 +2888,8 @@ PostgresMain(int argc, char *argv[], const char *username)
|
||||
*
|
||||
* This is also a good time to send collected statistics to the
|
||||
* collector, and to update the PS stats display. We avoid doing
|
||||
* those every time through the message loop because it'd slow down
|
||||
* processing of batched messages.
|
||||
* those every time through the message loop because it'd slow
|
||||
* down processing of batched messages.
|
||||
*/
|
||||
if (send_rfq)
|
||||
{
|
||||
@@ -3300,27 +3306,29 @@ ShowUsage(const char *title)
|
||||
/*
|
||||
* on_proc_exit handler to log end of session
|
||||
*/
|
||||
static void
|
||||
static void
|
||||
log_disconnections(int code, Datum arg)
|
||||
{
|
||||
Port *port = MyProcPort;
|
||||
Port *port = MyProcPort;
|
||||
struct timeval end;
|
||||
int hours, minutes, seconds;
|
||||
int hours,
|
||||
minutes,
|
||||
seconds;
|
||||
|
||||
char session_time[20];
|
||||
char uname[6+NAMEDATALEN];
|
||||
char dbname[10+NAMEDATALEN];
|
||||
char remote_host[7 + NI_MAXHOST];
|
||||
char remote_port[7 + NI_MAXSERV];
|
||||
|
||||
snprintf(uname, sizeof(uname)," user=%s",port->user_name);
|
||||
snprintf(dbname, sizeof(dbname)," database=%s",port->database_name);
|
||||
snprintf(remote_host,sizeof(remote_host)," host=%s",
|
||||
char session_time[20];
|
||||
char uname[6 + NAMEDATALEN];
|
||||
char dbname[10 + NAMEDATALEN];
|
||||
char remote_host[7 + NI_MAXHOST];
|
||||
char remote_port[7 + NI_MAXSERV];
|
||||
|
||||
snprintf(uname, sizeof(uname), " user=%s", port->user_name);
|
||||
snprintf(dbname, sizeof(dbname), " database=%s", port->database_name);
|
||||
snprintf(remote_host, sizeof(remote_host), " host=%s",
|
||||
port->remote_host);
|
||||
snprintf(remote_port,sizeof(remote_port)," port=%s",port->remote_port);
|
||||
snprintf(remote_port, sizeof(remote_port), " port=%s", port->remote_port);
|
||||
|
||||
|
||||
gettimeofday(&end,NULL);
|
||||
gettimeofday(&end, NULL);
|
||||
|
||||
if (end.tv_usec < port->session_start.tv_usec)
|
||||
{
|
||||
@@ -3338,16 +3346,20 @@ log_disconnections(int code, Datum arg)
|
||||
/* if time has gone backwards for some reason say so, or print time */
|
||||
|
||||
if (end.tv_sec < 0)
|
||||
snprintf(session_time,sizeof(session_time),"negative!");
|
||||
snprintf(session_time, sizeof(session_time), "negative!");
|
||||
else
|
||||
/* for stricter accuracy here we could round - this is close enough */
|
||||
|
||||
/*
|
||||
* for stricter accuracy here we could round - this is close
|
||||
* enough
|
||||
*/
|
||||
snprintf(session_time, sizeof(session_time),
|
||||
"%d:%02d:%02d.%02d",
|
||||
hours, minutes, seconds, (int) (end.tv_usec/10000));
|
||||
|
||||
"%d:%02d:%02d.%02d",
|
||||
hours, minutes, seconds, (int) (end.tv_usec / 10000));
|
||||
|
||||
ereport(
|
||||
LOG,
|
||||
(errmsg("disconnection: session time: %s%s%s%s%s",
|
||||
session_time,uname,dbname,remote_host,remote_port)));
|
||||
LOG,
|
||||
(errmsg("disconnection: session time: %s%s%s%s%s",
|
||||
session_time, uname, dbname, remote_host, remote_port)));
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/tcop/pquery.c,v 1.84 2004/08/29 04:12:50 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/tcop/pquery.c,v 1.85 2004/08/29 05:06:49 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -28,7 +28,7 @@
|
||||
* ActivePortal is the currently executing Portal (the most closely nested,
|
||||
* if there are several).
|
||||
*/
|
||||
Portal ActivePortal = NULL;
|
||||
Portal ActivePortal = NULL;
|
||||
|
||||
|
||||
static uint32 RunFromStore(Portal portal, ScanDirection direction, long count,
|
||||
@@ -246,7 +246,8 @@ PortalStart(Portal portal, ParamListInfo params)
|
||||
AssertState(portal->status == PORTAL_NEW); /* else extra PortalStart */
|
||||
|
||||
/*
|
||||
* Set up global portal context pointers. (Should we set QueryContext?)
|
||||
* Set up global portal context pointers. (Should we set
|
||||
* QueryContext?)
|
||||
*/
|
||||
saveActivePortal = ActivePortal;
|
||||
saveResourceOwner = CurrentResourceOwner;
|
||||
@@ -280,11 +281,11 @@ PortalStart(Portal portal, ParamListInfo params)
|
||||
SetQuerySnapshot();
|
||||
|
||||
/*
|
||||
* Create QueryDesc in portal's context; for the moment, set
|
||||
* the destination to None.
|
||||
* Create QueryDesc in portal's context; for the moment,
|
||||
* set the destination to None.
|
||||
*/
|
||||
queryDesc = CreateQueryDesc((Query *) linitial(portal->parseTrees),
|
||||
(Plan *) linitial(portal->planTrees),
|
||||
(Plan *) linitial(portal->planTrees),
|
||||
None_Receiver,
|
||||
params,
|
||||
false);
|
||||
@@ -308,7 +309,7 @@ PortalStart(Portal portal, ParamListInfo params)
|
||||
* Reset cursor position data to "start of query"
|
||||
*/
|
||||
portal->atStart = true;
|
||||
portal->atEnd = false; /* allow fetches */
|
||||
portal->atEnd = false; /* allow fetches */
|
||||
portal->portalPos = 0;
|
||||
portal->posOverflow = false;
|
||||
break;
|
||||
@@ -316,8 +317,8 @@ PortalStart(Portal portal, ParamListInfo params)
|
||||
case PORTAL_UTIL_SELECT:
|
||||
|
||||
/*
|
||||
* We don't set query snapshot here, because PortalRunUtility
|
||||
* will take care of it.
|
||||
* We don't set query snapshot here, because
|
||||
* PortalRunUtility will take care of it.
|
||||
*/
|
||||
portal->tupDesc =
|
||||
UtilityTupleDescriptor(((Query *) linitial(portal->parseTrees))->utilityStmt);
|
||||
@@ -326,7 +327,7 @@ PortalStart(Portal portal, ParamListInfo params)
|
||||
* Reset cursor position data to "start of query"
|
||||
*/
|
||||
portal->atStart = true;
|
||||
portal->atEnd = false; /* allow fetches */
|
||||
portal->atEnd = false; /* allow fetches */
|
||||
portal->portalPos = 0;
|
||||
portal->posOverflow = false;
|
||||
break;
|
||||
@@ -450,11 +451,11 @@ PortalRun(Portal portal, long count,
|
||||
if (log_executor_stats && portal->strategy != PORTAL_MULTI_QUERY)
|
||||
{
|
||||
ereport(DEBUG3,
|
||||
(errmsg_internal("PortalRun")));
|
||||
(errmsg_internal("PortalRun")));
|
||||
/* PORTAL_MULTI_QUERY logs its own stats per query */
|
||||
ResetUsage();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Check for improper portal use, and mark portal active.
|
||||
*/
|
||||
@@ -492,7 +493,8 @@ PortalRun(Portal portal, long count,
|
||||
portal->status = PORTAL_READY;
|
||||
|
||||
/*
|
||||
* Since it's a forward fetch, say DONE iff atEnd is now true.
|
||||
* Since it's a forward fetch, say DONE iff atEnd is now
|
||||
* true.
|
||||
*/
|
||||
result = portal->atEnd;
|
||||
break;
|
||||
@@ -531,7 +533,8 @@ PortalRun(Portal portal, long count,
|
||||
portal->status = PORTAL_READY;
|
||||
|
||||
/*
|
||||
* Since it's a forward fetch, say DONE iff atEnd is now true.
|
||||
* Since it's a forward fetch, say DONE iff atEnd is now
|
||||
* true.
|
||||
*/
|
||||
result = portal->atEnd;
|
||||
break;
|
||||
@@ -549,7 +552,7 @@ PortalRun(Portal portal, long count,
|
||||
default:
|
||||
elog(ERROR, "unrecognized portal strategy: %d",
|
||||
(int) portal->strategy);
|
||||
result = false; /* keep compiler quiet */
|
||||
result = false; /* keep compiler quiet */
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1026,7 +1029,7 @@ PortalRunFetch(Portal portal,
|
||||
|
||||
default:
|
||||
elog(ERROR, "unsupported portal strategy");
|
||||
result = 0; /* keep compiler quiet */
|
||||
result = 0; /* keep compiler quiet */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/tcop/utility.c,v 1.227 2004/08/29 04:12:50 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/tcop/utility.c,v 1.228 2004/08/29 05:06:49 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -144,7 +144,7 @@ DropErrorMsgNonExistent(RangeVar *rel, char rightkind)
|
||||
errmsg(rentry->nonexistent_msg, rel->relname)));
|
||||
}
|
||||
|
||||
Assert(false); /* Should be impossible */
|
||||
Assert(false); /* Should be impossible */
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -326,10 +326,10 @@ ProcessUtility(Node *parsetree,
|
||||
|
||||
switch (stmt->kind)
|
||||
{
|
||||
/*
|
||||
* START TRANSACTION, as defined by SQL99:
|
||||
* Identical to BEGIN. Same code for both.
|
||||
*/
|
||||
/*
|
||||
* START TRANSACTION, as defined by SQL99:
|
||||
* Identical to BEGIN. Same code for both.
|
||||
*/
|
||||
case TRANS_STMT_BEGIN:
|
||||
case TRANS_STMT_START:
|
||||
{
|
||||
@@ -367,14 +367,15 @@ ProcessUtility(Node *parsetree,
|
||||
|
||||
case TRANS_STMT_SAVEPOINT:
|
||||
{
|
||||
ListCell *cell;
|
||||
char *name = NULL;
|
||||
ListCell *cell;
|
||||
char *name = NULL;
|
||||
|
||||
RequireTransactionChain((void *)stmt, "SAVEPOINT");
|
||||
RequireTransactionChain((void *) stmt, "SAVEPOINT");
|
||||
|
||||
foreach (cell, stmt->options)
|
||||
foreach(cell, stmt->options)
|
||||
{
|
||||
DefElem *elem = lfirst(cell);
|
||||
DefElem *elem = lfirst(cell);
|
||||
|
||||
if (strcmp(elem->defname, "savepoint_name") == 0)
|
||||
name = strVal(elem->arg);
|
||||
}
|
||||
@@ -386,16 +387,17 @@ ProcessUtility(Node *parsetree,
|
||||
break;
|
||||
|
||||
case TRANS_STMT_RELEASE:
|
||||
RequireTransactionChain((void *)stmt, "RELEASE SAVEPOINT");
|
||||
RequireTransactionChain((void *) stmt, "RELEASE SAVEPOINT");
|
||||
ReleaseSavepoint(stmt->options);
|
||||
break;
|
||||
|
||||
case TRANS_STMT_ROLLBACK_TO:
|
||||
RequireTransactionChain((void *)stmt, "ROLLBACK TO SAVEPOINT");
|
||||
RequireTransactionChain((void *) stmt, "ROLLBACK TO SAVEPOINT");
|
||||
RollbackToSavepoint(stmt->options);
|
||||
|
||||
/*
|
||||
* CommitTransactionCommand is in charge
|
||||
* of re-defining the savepoint again
|
||||
* CommitTransactionCommand is in charge of
|
||||
* re-defining the savepoint again
|
||||
*/
|
||||
break;
|
||||
}
|
||||
@@ -686,10 +688,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 */
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -797,10 +799,10 @@ ProcessUtility(Node *parsetree,
|
||||
|
||||
if (strcmp(item->defname, "transaction_isolation") == 0)
|
||||
SetPGVariable("transaction_isolation",
|
||||
list_make1(item->arg), n->is_local);
|
||||
list_make1(item->arg), n->is_local);
|
||||
else if (strcmp(item->defname, "transaction_read_only") == 0)
|
||||
SetPGVariable("transaction_read_only",
|
||||
list_make1(item->arg), n->is_local);
|
||||
list_make1(item->arg), n->is_local);
|
||||
}
|
||||
}
|
||||
else if (strcmp(n->name, "SESSION CHARACTERISTICS") == 0)
|
||||
@@ -813,10 +815,10 @@ ProcessUtility(Node *parsetree,
|
||||
|
||||
if (strcmp(item->defname, "transaction_isolation") == 0)
|
||||
SetPGVariable("default_transaction_isolation",
|
||||
list_make1(item->arg), n->is_local);
|
||||
list_make1(item->arg), n->is_local);
|
||||
else if (strcmp(item->defname, "transaction_read_only") == 0)
|
||||
SetPGVariable("default_transaction_read_only",
|
||||
list_make1(item->arg), n->is_local);
|
||||
list_make1(item->arg), n->is_local);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1337,13 +1339,13 @@ CreateCommandTag(Node *parsetree)
|
||||
{
|
||||
AlterTableStmt *stmt = (AlterTableStmt *) parsetree;
|
||||
|
||||
/*
|
||||
* We might be supporting ALTER INDEX here, so
|
||||
* set the completion table appropriately.
|
||||
* Catch all other possibilities with ALTER TABLE
|
||||
/*
|
||||
* We might be supporting ALTER INDEX here, so set the
|
||||
* completion table appropriately. Catch all other
|
||||
* possibilities with ALTER TABLE
|
||||
*/
|
||||
|
||||
if(stmt->relkind == OBJECT_INDEX)
|
||||
if (stmt->relkind == OBJECT_INDEX)
|
||||
tag = "ALTER INDEX";
|
||||
else
|
||||
tag = "ALTER TABLE";
|
||||
|
||||
Reference in New Issue
Block a user