* Portions Copyright (c) 1994, Regents of the University of California
*
* 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 $
*
*-------------------------------------------------------------------------
*/
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->nattrs = 0;
* Portions Copyright (c) 1994, Regents of the University of California
*
* 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 $
*
*-------------------------------------------------------------------------
*/
static void
NotifyMyFrontEnd(char *relname, int32 listenerPID)
{
- if (whereToSendOutput == Remote)
+ if (whereToSendOutput == DestRemote)
{
StringInfoData buf;
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
}
if (pipe)
{
- if (whereToSendOutput == Remote)
+ if (whereToSendOutput == DestRemote)
ReceiveCopyBegin(cstate);
else
cstate->copy_file = stdin;
}
if (pipe)
{
- if (whereToSendOutput == Remote)
+ if (whereToSendOutput == DestRemote)
cstate->fe_copy = true;
else
cstate->copy_file = stdout;
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
return; /* keep compiler happy */
}
- /* Adjust dest if needed. MOVE wants destination None */
+ /* Adjust dest if needed. MOVE wants destination DestNone */
if (stmt->ismove)
dest = None_Receiver;
ExecutorRewind(queryDesc);
/* 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 */
ExecutorRun(queryDesc, ForwardScanDirection, 0L);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
SPI_cursor_fetch(Portal portal, bool forward, long count)
{
_SPI_cursor_operation(portal, forward, count,
- CreateDestReceiver(SPI, NULL));
- /* we know that the SPI receiver doesn't need a destroy call */
+ CreateDestReceiver(DestSPI, NULL));
+ /* we know that the DestSPI receiver doesn't need a destroy call */
}
if (!read_only)
CommandCounterIncrement();
- dest = CreateDestReceiver(queryTree->canSetTag ? SPI : None,
+ dest = CreateDestReceiver(queryTree->canSetTag ? DestSPI : DestNone,
NULL);
if (snapshot == InvalidSnapshot)
res = SPI_OK_SELINTO;
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 */
res = SPI_OK_UTILITY;
_SPI_current->processed = queryDesc->estate->es_processed;
_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())
elog(ERROR, "consistency check on SPI tuple count failed");
*/
_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");
/* Put the result into place for access by caller */
* Portions Copyright (c) 1994, Regents of the University of California
*
* 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 $
*
*-------------------------------------------------------------------------
*/
self->pub.rStartup = tstoreStartupReceiver;
self->pub.rShutdown = tstoreShutdownReceiver;
self->pub.rDestroy = tstoreDestroyReceiver;
- self->pub.mydest = Tuplestore;
+ self->pub.mydest = DestTuplestore;
self->tstore = tStore;
self->cxt = tContext;
*
*
* 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
*
SysLoggerPID = SysLogger_Start();
/*
- * Reset whereToSendOutput from Debug (its starting state) to None. This
- * stops ereport from sending log messages to stderr unless
+ * Reset whereToSendOutput from DestDebug (its starting state) to DestNone.
+ * This stops ereport from sending log messages to stderr unless
* Log_destination permits. We don't do this until the postmaster is
* fully launched, since startup failures may as well be reported to
* stderr.
*/
- whereToSendOutput = None;
+ whereToSendOutput = DestNone;
/*
* Initialize the statistics collector stuff
* Must do this now because authentication uses libpq to send messages.
*/
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
* Portions Copyright (c) 1994, Regents of the University of California
*
* 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 $
*
*-------------------------------------------------------------------------
*/
*/
static DestReceiver donothingDR = {
donothingReceive, donothingStartup, donothingCleanup, donothingCleanup,
- None
+ DestNone
};
static DestReceiver debugtupDR = {
debugtup, debugStartup, donothingCleanup, donothingCleanup,
- Debug
+ DestDebug
};
static DestReceiver spi_printtupDR = {
spi_printtup, spi_dest_startup, donothingCleanup, donothingCleanup,
- SPI
+ DestSPI
};
-/* Globally available receiver for None */
+/* Globally available receiver for DestNone */
DestReceiver *None_Receiver = &donothingDR;
/* ----------------
* CreateDestReceiver - return appropriate receiver function set for dest
*
- * Note: a Portal must be specified for destinations Remote, RemoteExecute,
- * and Tuplestore. It can be NULL for the others.
+ * Note: a Portal must be specified for destinations DestRemote,
+ * DestRemoteExecute, and DestTuplestore. It can be NULL for the others.
* ----------------
*/
DestReceiver *
{
switch (dest)
{
- case Remote:
- case RemoteExecute:
+ case DestRemote:
+ case DestRemoteExecute:
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);
- case None:
+ case DestNone:
return &donothingDR;
- case Debug:
+ case DestDebug:
return &debugtupDR;
- case SPI:
+ case DestSPI:
return &spi_printtupDR;
- case Tuplestore:
+ case DestTuplestore:
if (portal == NULL)
- elog(ERROR, "no portal specified for Tuplestore receiver");
+ elog(ERROR, "no portal specified for DestTuplestore receiver");
if (portal->holdStore == NULL ||
portal->holdContext == NULL)
elog(ERROR, "portal has no holdStore");
{
switch (dest)
{
- case Remote:
- case RemoteExecute:
+ case DestRemote:
+ case DestRemoteExecute:
pq_puttextmessage('C', commandTag);
break;
- case None:
- case Debug:
- case SPI:
- case Tuplestore:
+ case DestNone:
+ case DestDebug:
+ case DestSPI:
+ case DestTuplestore:
break;
}
}
{
switch (dest)
{
- case Remote:
- case RemoteExecute:
+ case DestRemote:
+ case DestRemoteExecute:
/*
* tell the fe that we saw an empty query string. In protocols
pq_puttextmessage('I', "");
break;
- case None:
- case Debug:
- case SPI:
- case Tuplestore:
+ case DestNone:
+ case DestDebug:
+ case DestSPI:
+ case DestTuplestore:
break;
}
}
{
switch (dest)
{
- case Remote:
- case RemoteExecute:
+ case DestRemote:
+ case DestRemoteExecute:
if (PG_PROTOCOL_MAJOR(FrontendProtocol) >= 3)
{
StringInfoData buf;
pq_flush();
break;
- case None:
- case Debug:
- case SPI:
- case Tuplestore:
+ case DestNone:
+ case DestDebug:
+ case DestSPI:
+ case DestTuplestore:
break;
}
}
*
*
* 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
* this is the "main" module of the postgres backend and
const char *debug_query_string; /* for pgmonitor and log_min_error_statement */
/* Note: whereToSendOutput is initialized for the bootstrap/standalone case */
-CommandDest whereToSendOutput = Debug;
+CommandDest whereToSendOutput = DestDebug;
/* flag for logging end of session */
bool Log_disconnections = false;
{
int result;
- if (whereToSendOutput == Remote)
+ if (whereToSendOutput == DestRemote)
result = SocketBackend(inBuf);
else
result = InteractiveBackend(inBuf);
/*
* Send ParseComplete.
*/
- if (whereToSendOutput == Remote)
+ if (whereToSendOutput == DestRemote)
pq_putemptymessage('1');
if (save_log_statement_stats)
/*
* Send BindComplete.
*/
- if (whereToSendOutput == Remote)
+ if (whereToSendOutput == DestRemote)
pq_putemptymessage('2');
}
/* Adjust destination to tell printtup.c what to do */
dest = whereToSendOutput;
- if (dest == Remote)
- dest = RemoteExecute;
+ if (dest == DestRemote)
+ dest = DestRemoteExecute;
portal = GetPortalByName(portal_name);
if (!PortalIsValid(portal))
else
{
/* Portal run not complete, so send PortalSuspended */
- if (whereToSendOutput == Remote)
+ if (whereToSendOutput == DestRemote)
pq_putemptymessage('s');
}
errmsg("unnamed prepared statement does not exist")));
}
- if (whereToSendOutput != Remote)
+ if (whereToSendOutput != DestRemote)
return; /* can't actually do anything... */
/*
(errcode(ERRCODE_UNDEFINED_CURSOR),
errmsg("portal \"%s\" does not exist", portal_name)));
- if (whereToSendOutput != Remote)
+ if (whereToSendOutput != DestRemote)
return; /* can't actually do anything... */
if (portal->tupDesc)
/*
* Send this backend's cancellation info to the frontend.
*/
- if (whereToSendOutput == Remote &&
+ if (whereToSendOutput == DestRemote &&
PG_PROTOCOL_MAJOR(FrontendProtocol) >= 2)
{
StringInfoData buf;
}
/* Welcome banner for standalone case */
- if (whereToSendOutput == Debug)
+ if (whereToSendOutput == DestDebug)
printf("\nPostgreSQL stand-alone backend %s\n", PG_VERSION);
/*
* Reset whereToSendOutput to prevent ereport from
* attempting to send any more messages to client.
*/
- if (whereToSendOutput == Remote)
- whereToSendOutput = None;
+ if (whereToSendOutput == DestRemote)
+ whereToSendOutput = DestNone;
proc_exit(0);
}
break;
}
- if (whereToSendOutput == Remote)
+ if (whereToSendOutput == DestRemote)
pq_putemptymessage('3'); /* CloseComplete */
}
break;
case 'H': /* flush */
pq_getmsgend(&input_message);
- if (whereToSendOutput == Remote)
+ if (whereToSendOutput == DestRemote)
pq_flush();
break;
* Reset whereToSendOutput to prevent ereport from attempting
* to send any more messages to client.
*/
- if (whereToSendOutput == Remote)
- whereToSendOutput = None;
+ if (whereToSendOutput == DestRemote)
+ whereToSendOutput = DestNone;
/*
* NOTE: if you are tempted to add more code here, DON'T!
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* Select the format codes for a portal's output.
*
* 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
- * other destination types.
+ * a DestRemote or DestRemoteExecute destination. It is not presently needed
+ * for other destination types.
*
* formats[] is the client format request, as per Bind message conventions.
*/
DestReceiver *treceiver;
PortalCreateHoldStore(portal);
- treceiver = CreateDestReceiver(Tuplestore, portal);
+ treceiver = CreateDestReceiver(DestTuplestore, portal);
PortalRunUtility(portal, linitial(portal->parseTrees),
treceiver, NULL);
(*treceiver->rDestroy) (treceiver);
ListCell *planlist_item;
/*
- * If the destination is RemoteExecute, change to None. The reason is
- * that the client won't be expecting any tuples, and indeed has no way to
- * know what they are, since there is no provision for Describe to send a
- * RowDescription message when this portal execution strategy is in
+ * If the destination is DestRemoteExecute, change to DestNone. The reason
+ * is that the client won't be expecting any tuples, and indeed has no way
+ * to know what they are, since there is no provision for Describe to send
+ * a RowDescription message when this portal execution strategy is in
* effect. This presently will only affect SELECT commands added to
* non-SELECT queries by rewrite rules: such commands will be executed,
* but the results will be discarded unless you use "simple Query"
* protocol.
*/
- if (dest->mydest == RemoteExecute)
+ if (dest->mydest == DestRemoteExecute)
dest = None_Receiver;
- if (altdest->mydest == RemoteExecute)
+ if (altdest->mydest == DestRemoteExecute)
altdest = None_Receiver;
/*
DestReceiver *treceiver;
PortalCreateHoldStore(portal);
- treceiver = CreateDestReceiver(Tuplestore, portal);
+ treceiver = CreateDestReceiver(DestTuplestore, portal);
PortalRunUtility(portal, linitial(portal->parseTrees),
treceiver, NULL);
(*treceiver->rDestroy) (treceiver);
/* Are we sitting on a row? */
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 */
return on_row ? 1L : 0L;
/*
* 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;
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
}
/* 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
* 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.
*/
- if (elevel >= FATAL && whereToSendOutput == Remote)
+ if (elevel >= FATAL && whereToSendOutput == DestRemote)
pq_endcopyout(true);
/* Emit the message to the right places */
* If we just reported a startup failure, the client will disconnect
* on receiving it, so don't send any more to the client.
*/
- if (PG_exception_stack == NULL && whereToSendOutput == Remote)
- whereToSendOutput = None;
+ if (PG_exception_stack == NULL && whereToSendOutput == DestRemote)
+ whereToSendOutput = DestNone;
/*
* fflush here is just to improve the odds that we get to see the
#endif /* WIN32 */
/* Write to stderr, if enabled */
- if ((Log_destination & LOG_DESTINATION_STDERR) || whereToSendOutput == Debug)
+ if ((Log_destination & LOG_DESTINATION_STDERR) || whereToSendOutput == DestDebug)
{
#ifdef WIN32
* Written by Peter Eisentraut
.
*
* 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 $
*
*--------------------------------------------------------------------
*/
* Don't do anything unless talking to an interactive frontend of protocol
* 3.0 or later.
*/
- if (whereToSendOutput != Remote ||
+ if (whereToSendOutput != DestRemote ||
PG_PROTOCOL_MAJOR(FrontendProtocol) < 3)
return;
* PQexec() or PQfn(). In this case, the results are sent
* 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.
*
* dest.c defines three functions that implement destination management:
* object not to disappear while still needed.
*
* 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.
*
*
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* 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 $
*
*-------------------------------------------------------------------------
*/
* CommandDest is a simplistic means of identifying the desired
* destination. Someday this will probably need to be improved.
*
- * Note: only the values None, Debug, Remote are legal for the global
- * variable whereToSendOutput. The other values may be used
+ * Note: only the values DestNone, DestDebug, DestRemote are legal for the
+ * global variable whereToSendOutput. The other values may be used
* as the destination for individual commands.
* ----------------
*/
typedef enum
{
- None, /* results are discarded */
- Debug, /* results go to debugging output */
- Remote, /* results sent to frontend process */
- RemoteExecute, /* sent to frontend, in Execute command */
- SPI, /* results sent to SPI manager */
- Tuplestore /* results sent to Tuplestore */
+ DestNone, /* results are discarded */
+ DestDebug, /* results go to debugging output */
+ DestRemote, /* results sent to frontend process */
+ DestRemoteExecute, /* sent to frontend, in Execute command */
+ DestSPI, /* results sent to SPI manager */
+ DestTuplestore /* results sent to Tuplestore */
} CommandDest;
/* ----------------
/* 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 */