Rename the members of CommandDest enum so they don't collide with other uses of

those names.  (Debug and None were pretty bad names anyway.)  I hope I catched
all uses of the names in comments too.
This commit is contained in:
Alvaro Herrera 2005-11-03 17:11:40 +00:00
parent 76c9ac8ebb
commit 902377c465
13 changed files with 112 additions and 109 deletions

View File

@ -9,7 +9,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/common/printtup.c,v 1.92 2005/10/15 02:49:08 momjian Exp $ * $PostgreSQL: pgsql/src/backend/access/common/printtup.c,v 1.93 2005/11/03 17:11:30 alvherre Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -94,8 +94,11 @@ printtup_create_DR(CommandDest dest, Portal portal)
self->portal = portal; self->portal = portal;
/* Send T message automatically if Remote, but not if RemoteExecute */ /*
self->sendDescrip = (dest == Remote); * Send T message automatically if DestRemote, but not if
* DestRemoteExecute
*/
self->sendDescrip = (dest == DestRemote);
self->attrinfo = NULL; self->attrinfo = NULL;
self->nattrs = 0; self->nattrs = 0;

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.126 2005/10/15 02:49:15 momjian Exp $ * $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.127 2005/11/03 17:11:34 alvherre Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -994,7 +994,7 @@ ProcessIncomingNotify(void)
static void static void
NotifyMyFrontEnd(char *relname, int32 listenerPID) NotifyMyFrontEnd(char *relname, int32 listenerPID)
{ {
if (whereToSendOutput == Remote) if (whereToSendOutput == DestRemote)
{ {
StringInfoData buf; StringInfoData buf;

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.253 2005/10/15 02:49:15 momjian Exp $ * $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.254 2005/11/03 17:11:34 alvherre Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -966,7 +966,7 @@ DoCopy(const CopyStmt *stmt)
} }
if (pipe) if (pipe)
{ {
if (whereToSendOutput == Remote) if (whereToSendOutput == DestRemote)
ReceiveCopyBegin(cstate); ReceiveCopyBegin(cstate);
else else
cstate->copy_file = stdin; cstate->copy_file = stdin;
@ -1017,7 +1017,7 @@ DoCopy(const CopyStmt *stmt)
} }
if (pipe) if (pipe)
{ {
if (whereToSendOutput == Remote) if (whereToSendOutput == DestRemote)
cstate->fe_copy = true; cstate->fe_copy = true;
else else
cstate->copy_file = stdout; cstate->copy_file = stdout;

View File

@ -14,7 +14,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/portalcmds.c,v 1.43 2005/10/15 02:49:15 momjian Exp $ * $PostgreSQL: pgsql/src/backend/commands/portalcmds.c,v 1.44 2005/11/03 17:11:35 alvherre Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -190,7 +190,7 @@ PerformPortalFetch(FetchStmt *stmt,
return; /* keep compiler happy */ return; /* keep compiler happy */
} }
/* Adjust dest if needed. MOVE wants destination None */ /* Adjust dest if needed. MOVE wants destination DestNone */
if (stmt->ismove) if (stmt->ismove)
dest = None_Receiver; dest = None_Receiver;
@ -369,7 +369,7 @@ PersistHoldablePortal(Portal portal)
ExecutorRewind(queryDesc); ExecutorRewind(queryDesc);
/* Change the destination to output to the tuplestore */ /* Change the destination to output to the tuplestore */
queryDesc->dest = CreateDestReceiver(Tuplestore, portal); queryDesc->dest = CreateDestReceiver(DestTuplestore, portal);
/* Fetch the result set into the tuplestore */ /* Fetch the result set into the tuplestore */
ExecutorRun(queryDesc, ForwardScanDirection, 0L); ExecutorRun(queryDesc, ForwardScanDirection, 0L);

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.143 2005/10/15 02:49:17 momjian Exp $ * $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.144 2005/11/03 17:11:36 alvherre Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -984,8 +984,8 @@ void
SPI_cursor_fetch(Portal portal, bool forward, long count) SPI_cursor_fetch(Portal portal, bool forward, long count)
{ {
_SPI_cursor_operation(portal, forward, count, _SPI_cursor_operation(portal, forward, count,
CreateDestReceiver(SPI, NULL)); CreateDestReceiver(DestSPI, NULL));
/* we know that the SPI receiver doesn't need a destroy call */ /* we know that the DestSPI receiver doesn't need a destroy call */
} }
@ -1418,7 +1418,7 @@ _SPI_execute_plan(_SPI_plan *plan, Datum *Values, const char *Nulls,
if (!read_only) if (!read_only)
CommandCounterIncrement(); CommandCounterIncrement();
dest = CreateDestReceiver(queryTree->canSetTag ? SPI : None, dest = CreateDestReceiver(queryTree->canSetTag ? DestSPI : DestNone,
NULL); NULL);
if (snapshot == InvalidSnapshot) if (snapshot == InvalidSnapshot)
@ -1527,7 +1527,7 @@ _SPI_pquery(QueryDesc *queryDesc, long tcount)
res = SPI_OK_SELINTO; res = SPI_OK_SELINTO;
queryDesc->dest = None_Receiver; /* don't output results */ queryDesc->dest = None_Receiver; /* don't output results */
} }
else if (queryDesc->dest->mydest != SPI) else if (queryDesc->dest->mydest != DestSPI)
{ {
/* Don't return SPI_OK_SELECT if we're discarding result */ /* Don't return SPI_OK_SELECT if we're discarding result */
res = SPI_OK_UTILITY; res = SPI_OK_UTILITY;
@ -1560,7 +1560,7 @@ _SPI_pquery(QueryDesc *queryDesc, long tcount)
_SPI_current->processed = queryDesc->estate->es_processed; _SPI_current->processed = queryDesc->estate->es_processed;
_SPI_current->lastoid = queryDesc->estate->es_lastoid; _SPI_current->lastoid = queryDesc->estate->es_lastoid;
if (operation == CMD_SELECT && queryDesc->dest->mydest == SPI) if (operation == CMD_SELECT && queryDesc->dest->mydest == DestSPI)
{ {
if (_SPI_checktuples()) if (_SPI_checktuples())
elog(ERROR, "consistency check on SPI tuple count failed"); elog(ERROR, "consistency check on SPI tuple count failed");
@ -1646,7 +1646,7 @@ _SPI_cursor_operation(Portal portal, bool forward, long count,
*/ */
_SPI_current->processed = nfetched; _SPI_current->processed = nfetched;
if (dest->mydest == SPI && _SPI_checktuples()) if (dest->mydest == DestSPI && _SPI_checktuples())
elog(ERROR, "consistency check on SPI tuple count failed"); elog(ERROR, "consistency check on SPI tuple count failed");
/* Put the result into place for access by caller */ /* Put the result into place for access by caller */

View File

@ -9,7 +9,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/tstoreReceiver.c,v 1.14 2005/03/16 21:38:08 tgl Exp $ * $PostgreSQL: pgsql/src/backend/executor/tstoreReceiver.c,v 1.15 2005/11/03 17:11:36 alvherre Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -81,7 +81,7 @@ CreateTuplestoreDestReceiver(Tuplestorestate *tStore,
self->pub.rStartup = tstoreStartupReceiver; self->pub.rStartup = tstoreStartupReceiver;
self->pub.rShutdown = tstoreShutdownReceiver; self->pub.rShutdown = tstoreShutdownReceiver;
self->pub.rDestroy = tstoreDestroyReceiver; self->pub.rDestroy = tstoreDestroyReceiver;
self->pub.mydest = Tuplestore; self->pub.mydest = DestTuplestore;
self->tstore = tStore; self->tstore = tStore;
self->cxt = tContext; self->cxt = tContext;

View File

@ -37,7 +37,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.472 2005/10/22 14:27:28 adunstan Exp $ * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.473 2005/11/03 17:11:36 alvherre Exp $
* *
* NOTES * NOTES
* *
@ -906,13 +906,13 @@ PostmasterMain(int argc, char *argv[])
SysLoggerPID = SysLogger_Start(); SysLoggerPID = SysLogger_Start();
/* /*
* Reset whereToSendOutput from Debug (its starting state) to None. This * Reset whereToSendOutput from DestDebug (its starting state) to DestNone.
* stops ereport from sending log messages to stderr unless * This stops ereport from sending log messages to stderr unless
* Log_destination permits. We don't do this until the postmaster is * Log_destination permits. We don't do this until the postmaster is
* fully launched, since startup failures may as well be reported to * fully launched, since startup failures may as well be reported to
* stderr. * stderr.
*/ */
whereToSendOutput = None; whereToSendOutput = DestNone;
/* /*
* Initialize the statistics collector stuff * Initialize the statistics collector stuff
@ -2654,7 +2654,7 @@ BackendRun(Port *port)
* Must do this now because authentication uses libpq to send messages. * Must do this now because authentication uses libpq to send messages.
*/ */
pq_init(); /* initialize libpq to talk to client */ pq_init(); /* initialize libpq to talk to client */
whereToSendOutput = Remote; /* now safe to ereport to client */ whereToSendOutput = DestRemote; /* now safe to ereport to client */
/* /*
* We arrange for a simple exit(0) if we receive SIGTERM or SIGQUIT during * We arrange for a simple exit(0) if we receive SIGTERM or SIGQUIT during

View File

@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/tcop/dest.c,v 1.66 2005/10/15 02:49:26 momjian Exp $ * $PostgreSQL: pgsql/src/backend/tcop/dest.c,v 1.67 2005/11/03 17:11:38 alvherre Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -62,20 +62,20 @@ donothingCleanup(DestReceiver *self)
*/ */
static DestReceiver donothingDR = { static DestReceiver donothingDR = {
donothingReceive, donothingStartup, donothingCleanup, donothingCleanup, donothingReceive, donothingStartup, donothingCleanup, donothingCleanup,
None DestNone
}; };
static DestReceiver debugtupDR = { static DestReceiver debugtupDR = {
debugtup, debugStartup, donothingCleanup, donothingCleanup, debugtup, debugStartup, donothingCleanup, donothingCleanup,
Debug DestDebug
}; };
static DestReceiver spi_printtupDR = { static DestReceiver spi_printtupDR = {
spi_printtup, spi_dest_startup, donothingCleanup, donothingCleanup, spi_printtup, spi_dest_startup, donothingCleanup, donothingCleanup,
SPI DestSPI
}; };
/* Globally available receiver for None */ /* Globally available receiver for DestNone */
DestReceiver *None_Receiver = &donothingDR; DestReceiver *None_Receiver = &donothingDR;
@ -92,8 +92,8 @@ BeginCommand(const char *commandTag, CommandDest dest)
/* ---------------- /* ----------------
* CreateDestReceiver - return appropriate receiver function set for dest * CreateDestReceiver - return appropriate receiver function set for dest
* *
* Note: a Portal must be specified for destinations Remote, RemoteExecute, * Note: a Portal must be specified for destinations DestRemote,
* and Tuplestore. It can be NULL for the others. * DestRemoteExecute, and DestTuplestore. It can be NULL for the others.
* ---------------- * ----------------
*/ */
DestReceiver * DestReceiver *
@ -101,24 +101,24 @@ CreateDestReceiver(CommandDest dest, Portal portal)
{ {
switch (dest) switch (dest)
{ {
case Remote: case DestRemote:
case RemoteExecute: case DestRemoteExecute:
if (portal == NULL) if (portal == NULL)
elog(ERROR, "no portal specified for Remote receiver"); elog(ERROR, "no portal specified for DestRemote receiver");
return printtup_create_DR(dest, portal); return printtup_create_DR(dest, portal);
case None: case DestNone:
return &donothingDR; return &donothingDR;
case Debug: case DestDebug:
return &debugtupDR; return &debugtupDR;
case SPI: case DestSPI:
return &spi_printtupDR; return &spi_printtupDR;
case Tuplestore: case DestTuplestore:
if (portal == NULL) if (portal == NULL)
elog(ERROR, "no portal specified for Tuplestore receiver"); elog(ERROR, "no portal specified for DestTuplestore receiver");
if (portal->holdStore == NULL || if (portal->holdStore == NULL ||
portal->holdContext == NULL) portal->holdContext == NULL)
elog(ERROR, "portal has no holdStore"); elog(ERROR, "portal has no holdStore");
@ -139,15 +139,15 @@ EndCommand(const char *commandTag, CommandDest dest)
{ {
switch (dest) switch (dest)
{ {
case Remote: case DestRemote:
case RemoteExecute: case DestRemoteExecute:
pq_puttextmessage('C', commandTag); pq_puttextmessage('C', commandTag);
break; break;
case None: case DestNone:
case Debug: case DestDebug:
case SPI: case DestSPI:
case Tuplestore: case DestTuplestore:
break; break;
} }
} }
@ -169,8 +169,8 @@ NullCommand(CommandDest dest)
{ {
switch (dest) switch (dest)
{ {
case Remote: case DestRemote:
case RemoteExecute: case DestRemoteExecute:
/* /*
* tell the fe that we saw an empty query string. In protocols * tell the fe that we saw an empty query string. In protocols
@ -182,10 +182,10 @@ NullCommand(CommandDest dest)
pq_puttextmessage('I', ""); pq_puttextmessage('I', "");
break; break;
case None: case DestNone:
case Debug: case DestDebug:
case SPI: case DestSPI:
case Tuplestore: case DestTuplestore:
break; break;
} }
} }
@ -206,8 +206,8 @@ ReadyForQuery(CommandDest dest)
{ {
switch (dest) switch (dest)
{ {
case Remote: case DestRemote:
case RemoteExecute: case DestRemoteExecute:
if (PG_PROTOCOL_MAJOR(FrontendProtocol) >= 3) if (PG_PROTOCOL_MAJOR(FrontendProtocol) >= 3)
{ {
StringInfoData buf; StringInfoData buf;
@ -222,10 +222,10 @@ ReadyForQuery(CommandDest dest)
pq_flush(); pq_flush();
break; break;
case None: case DestNone:
case Debug: case DestDebug:
case SPI: case DestSPI:
case Tuplestore: case DestTuplestore:
break; break;
} }
} }

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.467 2005/10/20 20:05:45 tgl Exp $ * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.468 2005/11/03 17:11:38 alvherre Exp $
* *
* NOTES * NOTES
* this is the "main" module of the postgres backend and * this is the "main" module of the postgres backend and
@ -74,7 +74,7 @@ extern char *optarg;
const char *debug_query_string; /* for pgmonitor and log_min_error_statement */ const char *debug_query_string; /* for pgmonitor and log_min_error_statement */
/* Note: whereToSendOutput is initialized for the bootstrap/standalone case */ /* Note: whereToSendOutput is initialized for the bootstrap/standalone case */
CommandDest whereToSendOutput = Debug; CommandDest whereToSendOutput = DestDebug;
/* flag for logging end of session */ /* flag for logging end of session */
bool Log_disconnections = false; bool Log_disconnections = false;
@ -404,7 +404,7 @@ ReadCommand(StringInfo inBuf)
{ {
int result; int result;
if (whereToSendOutput == Remote) if (whereToSendOutput == DestRemote)
result = SocketBackend(inBuf); result = SocketBackend(inBuf);
else else
result = InteractiveBackend(inBuf); result = InteractiveBackend(inBuf);
@ -1364,7 +1364,7 @@ exec_parse_message(const char *query_string, /* string to execute */
/* /*
* Send ParseComplete. * Send ParseComplete.
*/ */
if (whereToSendOutput == Remote) if (whereToSendOutput == DestRemote)
pq_putemptymessage('1'); pq_putemptymessage('1');
if (save_log_statement_stats) if (save_log_statement_stats)
@ -1650,7 +1650,7 @@ exec_bind_message(StringInfo input_message)
/* /*
* Send BindComplete. * Send BindComplete.
*/ */
if (whereToSendOutput == Remote) if (whereToSendOutput == DestRemote)
pq_putemptymessage('2'); pq_putemptymessage('2');
} }
@ -1678,8 +1678,8 @@ exec_execute_message(const char *portal_name, long max_rows)
/* Adjust destination to tell printtup.c what to do */ /* Adjust destination to tell printtup.c what to do */
dest = whereToSendOutput; dest = whereToSendOutput;
if (dest == Remote) if (dest == DestRemote)
dest = RemoteExecute; dest = DestRemoteExecute;
portal = GetPortalByName(portal_name); portal = GetPortalByName(portal_name);
if (!PortalIsValid(portal)) if (!PortalIsValid(portal))
@ -1835,7 +1835,7 @@ exec_execute_message(const char *portal_name, long max_rows)
else else
{ {
/* Portal run not complete, so send PortalSuspended */ /* Portal run not complete, so send PortalSuspended */
if (whereToSendOutput == Remote) if (whereToSendOutput == DestRemote)
pq_putemptymessage('s'); pq_putemptymessage('s');
} }
@ -1913,7 +1913,7 @@ exec_describe_statement_message(const char *stmt_name)
errmsg("unnamed prepared statement does not exist"))); errmsg("unnamed prepared statement does not exist")));
} }
if (whereToSendOutput != Remote) if (whereToSendOutput != DestRemote)
return; /* can't actually do anything... */ return; /* can't actually do anything... */
/* /*
@ -1959,7 +1959,7 @@ exec_describe_portal_message(const char *portal_name)
(errcode(ERRCODE_UNDEFINED_CURSOR), (errcode(ERRCODE_UNDEFINED_CURSOR),
errmsg("portal \"%s\" does not exist", portal_name))); errmsg("portal \"%s\" does not exist", portal_name)));
if (whereToSendOutput != Remote) if (whereToSendOutput != DestRemote)
return; /* can't actually do anything... */ return; /* can't actually do anything... */
if (portal->tupDesc) if (portal->tupDesc)
@ -2938,7 +2938,7 @@ PostgresMain(int argc, char *argv[], const char *username)
/* /*
* Send this backend's cancellation info to the frontend. * Send this backend's cancellation info to the frontend.
*/ */
if (whereToSendOutput == Remote && if (whereToSendOutput == DestRemote &&
PG_PROTOCOL_MAJOR(FrontendProtocol) >= 2) PG_PROTOCOL_MAJOR(FrontendProtocol) >= 2)
{ {
StringInfoData buf; StringInfoData buf;
@ -2951,7 +2951,7 @@ PostgresMain(int argc, char *argv[], const char *username)
} }
/* Welcome banner for standalone case */ /* Welcome banner for standalone case */
if (whereToSendOutput == Debug) if (whereToSendOutput == DestDebug)
printf("\nPostgreSQL stand-alone backend %s\n", PG_VERSION); printf("\nPostgreSQL stand-alone backend %s\n", PG_VERSION);
/* /*
@ -3239,8 +3239,8 @@ PostgresMain(int argc, char *argv[], const char *username)
* Reset whereToSendOutput to prevent ereport from * Reset whereToSendOutput to prevent ereport from
* attempting to send any more messages to client. * attempting to send any more messages to client.
*/ */
if (whereToSendOutput == Remote) if (whereToSendOutput == DestRemote)
whereToSendOutput = None; whereToSendOutput = DestNone;
proc_exit(0); proc_exit(0);
} }
@ -3294,7 +3294,7 @@ PostgresMain(int argc, char *argv[], const char *username)
break; break;
} }
if (whereToSendOutput == Remote) if (whereToSendOutput == DestRemote)
pq_putemptymessage('3'); /* CloseComplete */ pq_putemptymessage('3'); /* CloseComplete */
} }
break; break;
@ -3328,7 +3328,7 @@ PostgresMain(int argc, char *argv[], const char *username)
case 'H': /* flush */ case 'H': /* flush */
pq_getmsgend(&input_message); pq_getmsgend(&input_message);
if (whereToSendOutput == Remote) if (whereToSendOutput == DestRemote)
pq_flush(); pq_flush();
break; break;
@ -3350,8 +3350,8 @@ PostgresMain(int argc, char *argv[], const char *username)
* Reset whereToSendOutput to prevent ereport from attempting * Reset whereToSendOutput to prevent ereport from attempting
* to send any more messages to client. * to send any more messages to client.
*/ */
if (whereToSendOutput == Remote) if (whereToSendOutput == DestRemote)
whereToSendOutput = None; whereToSendOutput = DestNone;
/* /*
* NOTE: if you are tempted to add more code here, DON'T! * NOTE: if you are tempted to add more code here, DON'T!

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/tcop/pquery.c,v 1.95 2005/10/15 02:49:27 momjian Exp $ * $PostgreSQL: pgsql/src/backend/tcop/pquery.c,v 1.96 2005/11/03 17:11:38 alvherre Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -471,8 +471,8 @@ PortalStart(Portal portal, ParamListInfo params, Snapshot snapshot)
* Select the format codes for a portal's output. * Select the format codes for a portal's output.
* *
* This must be run after PortalStart for a portal that will be read by * This must be run after PortalStart for a portal that will be read by
* a Remote or RemoteExecute destination. It is not presently needed for * a DestRemote or DestRemoteExecute destination. It is not presently needed
* other destination types. * for other destination types.
* *
* formats[] is the client format request, as per Bind message conventions. * formats[] is the client format request, as per Bind message conventions.
*/ */
@ -633,7 +633,7 @@ PortalRun(Portal portal, long count,
DestReceiver *treceiver; DestReceiver *treceiver;
PortalCreateHoldStore(portal); PortalCreateHoldStore(portal);
treceiver = CreateDestReceiver(Tuplestore, portal); treceiver = CreateDestReceiver(DestTuplestore, portal);
PortalRunUtility(portal, linitial(portal->parseTrees), PortalRunUtility(portal, linitial(portal->parseTrees),
treceiver, NULL); treceiver, NULL);
(*treceiver->rDestroy) (treceiver); (*treceiver->rDestroy) (treceiver);
@ -1015,18 +1015,18 @@ PortalRunMulti(Portal portal,
ListCell *planlist_item; ListCell *planlist_item;
/* /*
* If the destination is RemoteExecute, change to None. The reason is * If the destination is DestRemoteExecute, change to DestNone. The reason
* that the client won't be expecting any tuples, and indeed has no way to * is that the client won't be expecting any tuples, and indeed has no way
* know what they are, since there is no provision for Describe to send a * to know what they are, since there is no provision for Describe to send
* RowDescription message when this portal execution strategy is in * a RowDescription message when this portal execution strategy is in
* effect. This presently will only affect SELECT commands added to * effect. This presently will only affect SELECT commands added to
* non-SELECT queries by rewrite rules: such commands will be executed, * non-SELECT queries by rewrite rules: such commands will be executed,
* but the results will be discarded unless you use "simple Query" * but the results will be discarded unless you use "simple Query"
* protocol. * protocol.
*/ */
if (dest->mydest == RemoteExecute) if (dest->mydest == DestRemoteExecute)
dest = None_Receiver; dest = None_Receiver;
if (altdest->mydest == RemoteExecute) if (altdest->mydest == DestRemoteExecute)
altdest = None_Receiver; altdest = None_Receiver;
/* /*
@ -1184,7 +1184,7 @@ PortalRunFetch(Portal portal,
DestReceiver *treceiver; DestReceiver *treceiver;
PortalCreateHoldStore(portal); PortalCreateHoldStore(portal);
treceiver = CreateDestReceiver(Tuplestore, portal); treceiver = CreateDestReceiver(DestTuplestore, portal);
PortalRunUtility(portal, linitial(portal->parseTrees), PortalRunUtility(portal, linitial(portal->parseTrees),
treceiver, NULL); treceiver, NULL);
(*treceiver->rDestroy) (treceiver); (*treceiver->rDestroy) (treceiver);
@ -1371,7 +1371,7 @@ DoPortalRunFetch(Portal portal,
/* Are we sitting on a row? */ /* Are we sitting on a row? */
on_row = (!portal->atStart && !portal->atEnd); on_row = (!portal->atStart && !portal->atEnd);
if (dest->mydest == None) if (dest->mydest == DestNone)
{ {
/* MOVE 0 returns 0/1 based on if FETCH 0 would return a row */ /* MOVE 0 returns 0/1 based on if FETCH 0 would return a row */
return on_row ? 1L : 0L; return on_row ? 1L : 0L;
@ -1398,7 +1398,7 @@ DoPortalRunFetch(Portal portal,
/* /*
* Optimize MOVE BACKWARD ALL into a Rewind. * Optimize MOVE BACKWARD ALL into a Rewind.
*/ */
if (!forward && count == FETCH_ALL && dest->mydest == None) if (!forward && count == FETCH_ALL && dest->mydest == DestNone)
{ {
long result = portal->portalPos; long result = portal->portalPos;

View File

@ -42,7 +42,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.165 2005/10/15 02:49:32 momjian Exp $ * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.166 2005/11/03 17:11:39 alvherre Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -223,7 +223,7 @@ errstart(int elevel, const char *filename, int lineno,
} }
/* Determine whether message is enabled for client output */ /* Determine whether message is enabled for client output */
if (whereToSendOutput == Remote && elevel != COMMERROR) if (whereToSendOutput == DestRemote && elevel != COMMERROR)
{ {
/* /*
* client_min_messages is honored only after we complete the * client_min_messages is honored only after we complete the
@ -374,7 +374,7 @@ errfinish(int dummy,...)
* we must do this even if client is fool enough to have set * we must do this even if client is fool enough to have set
* client_min_messages above FATAL, so don't look at output_to_client. * client_min_messages above FATAL, so don't look at output_to_client.
*/ */
if (elevel >= FATAL && whereToSendOutput == Remote) if (elevel >= FATAL && whereToSendOutput == DestRemote)
pq_endcopyout(true); pq_endcopyout(true);
/* Emit the message to the right places */ /* Emit the message to the right places */
@ -412,8 +412,8 @@ errfinish(int dummy,...)
* If we just reported a startup failure, the client will disconnect * If we just reported a startup failure, the client will disconnect
* on receiving it, so don't send any more to the client. * on receiving it, so don't send any more to the client.
*/ */
if (PG_exception_stack == NULL && whereToSendOutput == Remote) if (PG_exception_stack == NULL && whereToSendOutput == DestRemote)
whereToSendOutput = None; whereToSendOutput = DestNone;
/* /*
* fflush here is just to improve the odds that we get to see the * fflush here is just to improve the odds that we get to see the
@ -1684,7 +1684,7 @@ send_message_to_server_log(ErrorData *edata)
#endif /* WIN32 */ #endif /* WIN32 */
/* Write to stderr, if enabled */ /* Write to stderr, if enabled */
if ((Log_destination & LOG_DESTINATION_STDERR) || whereToSendOutput == Debug) if ((Log_destination & LOG_DESTINATION_STDERR) || whereToSendOutput == DestDebug)
{ {
#ifdef WIN32 #ifdef WIN32

View File

@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>. * Written by Peter Eisentraut <peter_e@gmx.net>.
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.296 2005/10/29 00:31:52 petere Exp $ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.297 2005/11/03 17:11:39 alvherre Exp $
* *
*-------------------------------------------------------------------- *--------------------------------------------------------------------
*/ */
@ -3323,7 +3323,7 @@ BeginReportingGUCOptions(void)
* Don't do anything unless talking to an interactive frontend of protocol * Don't do anything unless talking to an interactive frontend of protocol
* 3.0 or later. * 3.0 or later.
*/ */
if (whereToSendOutput != Remote || if (whereToSendOutput != DestRemote ||
PG_PROTOCOL_MAJOR(FrontendProtocol) < 3) PG_PROTOCOL_MAJOR(FrontendProtocol) < 3)
return; return;

View File

@ -15,7 +15,7 @@
* PQexec() or PQfn(). In this case, the results are sent * PQexec() or PQfn(). In this case, the results are sent
* to the frontend via the functions in backend/libpq. * to the frontend via the functions in backend/libpq.
* *
* - None is the destination when the system executes * - DestNone is the destination when the system executes
* a query internally. The results are discarded. * a query internally. The results are discarded.
* *
* dest.c defines three functions that implement destination management: * dest.c defines three functions that implement destination management:
@ -47,14 +47,14 @@
* object not to disappear while still needed. * object not to disappear while still needed.
* *
* Special provision: None_Receiver is a permanently available receiver * Special provision: None_Receiver is a permanently available receiver
* object for the None destination. This avoids useless creation/destroy * object for the DestNone destination. This avoids useless creation/destroy
* calls in portal and cursor manipulations. * calls in portal and cursor manipulations.
* *
* *
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/tcop/dest.h,v 1.47 2005/10/15 02:49:46 momjian Exp $ * $PostgreSQL: pgsql/src/include/tcop/dest.h,v 1.48 2005/11/03 17:11:40 alvherre Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -72,19 +72,19 @@
* CommandDest is a simplistic means of identifying the desired * CommandDest is a simplistic means of identifying the desired
* destination. Someday this will probably need to be improved. * destination. Someday this will probably need to be improved.
* *
* Note: only the values None, Debug, Remote are legal for the global * Note: only the values DestNone, DestDebug, DestRemote are legal for the
* variable whereToSendOutput. The other values may be used * global variable whereToSendOutput. The other values may be used
* as the destination for individual commands. * as the destination for individual commands.
* ---------------- * ----------------
*/ */
typedef enum typedef enum
{ {
None, /* results are discarded */ DestNone, /* results are discarded */
Debug, /* results go to debugging output */ DestDebug, /* results go to debugging output */
Remote, /* results sent to frontend process */ DestRemote, /* results sent to frontend process */
RemoteExecute, /* sent to frontend, in Execute command */ DestRemoteExecute, /* sent to frontend, in Execute command */
SPI, /* results sent to SPI manager */ DestSPI, /* results sent to SPI manager */
Tuplestore /* results sent to Tuplestore */ DestTuplestore /* results sent to Tuplestore */
} CommandDest; } CommandDest;
/* ---------------- /* ----------------
@ -115,7 +115,7 @@ struct _DestReceiver
/* Private fields might appear beyond this point... */ /* Private fields might appear beyond this point... */
}; };
extern DestReceiver *None_Receiver; /* permanent receiver for None */ extern DestReceiver *None_Receiver; /* permanent receiver for DestNone */
/* This is a forward reference to utils/portal.h */ /* This is a forward reference to utils/portal.h */