Tom Lane wrote:

> I thought renaming them was a better idea, actually.

Here is a patch for that.  I will apply this to HEAD later today.

-- 
Alvaro Herrera       Valdivia, Chile   ICBM: S 39º 49' 17.7", W 73º 14' 26.8"
"The eagle never lost so much time, as
when he submitted to learn of the crow." (William Blake)
Index: src/backend/access/common/printtup.c
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/access/common/printtup.c,v
retrieving revision 1.92
diff -c -r1.92 printtup.c
*** src/backend/access/common/printtup.c        15 Oct 2005 02:49:08 -0000      
1.92
--- src/backend/access/common/printtup.c        2 Nov 2005 12:12:58 -0000
***************
*** 94,101 ****
  
        self->portal = portal;
  
!       /* Send T message automatically if Remote, but not if RemoteExecute */
!       self->sendDescrip = (dest == Remote);
  
        self->attrinfo = NULL;
        self->nattrs = 0;
--- 94,104 ----
  
        self->portal = portal;
  
!       /*
!        * Send T message automatically if DestRemote, but not if
!        * DestRemoteExecute
!        */
!       self->sendDescrip = (dest == DestRemote);
  
        self->attrinfo = NULL;
        self->nattrs = 0;
Index: src/backend/commands/async.c
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/commands/async.c,v
retrieving revision 1.126
diff -c -r1.126 async.c
*** src/backend/commands/async.c        15 Oct 2005 02:49:15 -0000      1.126
--- src/backend/commands/async.c        2 Nov 2005 12:14:08 -0000
***************
*** 994,1000 ****
  static void
  NotifyMyFrontEnd(char *relname, int32 listenerPID)
  {
!       if (whereToSendOutput == Remote)
        {
                StringInfoData buf;
  
--- 994,1000 ----
  static void
  NotifyMyFrontEnd(char *relname, int32 listenerPID)
  {
!       if (whereToSendOutput == DestRemote)
        {
                StringInfoData buf;
  
Index: src/backend/commands/copy.c
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/commands/copy.c,v
retrieving revision 1.253
diff -c -r1.253 copy.c
*** src/backend/commands/copy.c 15 Oct 2005 02:49:15 -0000      1.253
--- src/backend/commands/copy.c 2 Nov 2005 12:14:42 -0000
***************
*** 966,972 ****
                }
                if (pipe)
                {
!                       if (whereToSendOutput == Remote)
                                ReceiveCopyBegin(cstate);
                        else
                                cstate->copy_file = stdin;
--- 966,972 ----
                }
                if (pipe)
                {
!                       if (whereToSendOutput == DestRemote)
                                ReceiveCopyBegin(cstate);
                        else
                                cstate->copy_file = stdin;
***************
*** 1017,1023 ****
                }
                if (pipe)
                {
!                       if (whereToSendOutput == Remote)
                                cstate->fe_copy = true;
                        else
                                cstate->copy_file = stdout;
--- 1017,1023 ----
                }
                if (pipe)
                {
!                       if (whereToSendOutput == DestRemote)
                                cstate->fe_copy = true;
                        else
                                cstate->copy_file = stdout;
Index: src/backend/commands/portalcmds.c
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/commands/portalcmds.c,v
retrieving revision 1.43
diff -c -r1.43 portalcmds.c
*** src/backend/commands/portalcmds.c   15 Oct 2005 02:49:15 -0000      1.43
--- src/backend/commands/portalcmds.c   2 Nov 2005 12:49:43 -0000
***************
*** 190,196 ****
                return;                                 /* keep compiler happy 
*/
        }
  
!       /* Adjust dest if needed.  MOVE wants destination None */
        if (stmt->ismove)
                dest = None_Receiver;
  
--- 190,196 ----
                return;                                 /* keep compiler happy 
*/
        }
  
!       /* Adjust dest if needed.  MOVE wants destination DestNone */
        if (stmt->ismove)
                dest = None_Receiver;
  
***************
*** 369,375 ****
                ExecutorRewind(queryDesc);
  
                /* Change the destination to output to the tuplestore */
!               queryDesc->dest = CreateDestReceiver(Tuplestore, portal);
  
                /* Fetch the result set into the tuplestore */
                ExecutorRun(queryDesc, ForwardScanDirection, 0L);
--- 369,375 ----
                ExecutorRewind(queryDesc);
  
                /* Change the destination to output to the tuplestore */
!               queryDesc->dest = CreateDestReceiver(DestTuplestore, portal);
  
                /* Fetch the result set into the tuplestore */
                ExecutorRun(queryDesc, ForwardScanDirection, 0L);
Index: src/backend/executor/spi.c
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/executor/spi.c,v
retrieving revision 1.143
diff -c -r1.143 spi.c
*** src/backend/executor/spi.c  15 Oct 2005 02:49:17 -0000      1.143
--- src/backend/executor/spi.c  2 Nov 2005 12:55:26 -0000
***************
*** 984,991 ****
  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 */
  }
  
  
--- 984,991 ----
  SPI_cursor_fetch(Portal portal, bool forward, long count)
  {
        _SPI_cursor_operation(portal, forward, count,
!                                                 CreateDestReceiver(DestSPI, 
NULL));
!       /* we know that the DestSPI receiver doesn't need a destroy call */
  }
  
  
***************
*** 1418,1424 ****
                                if (!read_only)
                                        CommandCounterIncrement();
  
!                               dest = CreateDestReceiver(queryTree->canSetTag 
? SPI : None,
                                                                                
  NULL);
  
                                if (snapshot == InvalidSnapshot)
--- 1418,1424 ----
                                if (!read_only)
                                        CommandCounterIncrement();
  
!                               dest = CreateDestReceiver(queryTree->canSetTag 
? DestSPI : DestNone,
                                                                                
  NULL);
  
                                if (snapshot == InvalidSnapshot)
***************
*** 1527,1533 ****
                                res = SPI_OK_SELINTO;
                                queryDesc->dest = None_Receiver;                
/* don't output results */
                        }
!                       else if (queryDesc->dest->mydest != SPI)
                        {
                                /* Don't return SPI_OK_SELECT if we're 
discarding result */
                                res = SPI_OK_UTILITY;
--- 1527,1533 ----
                                res = SPI_OK_SELINTO;
                                queryDesc->dest = None_Receiver;                
/* don't output results */
                        }
!                       else if (queryDesc->dest->mydest != DestSPI)
                        {
                                /* Don't return SPI_OK_SELECT if we're 
discarding result */
                                res = SPI_OK_UTILITY;
***************
*** 1560,1566 ****
        _SPI_current->processed = queryDesc->estate->es_processed;
        _SPI_current->lastoid = queryDesc->estate->es_lastoid;
  
!       if (operation == CMD_SELECT && queryDesc->dest->mydest == SPI)
        {
                if (_SPI_checktuples())
                        elog(ERROR, "consistency check on SPI tuple count 
failed");
--- 1560,1566 ----
        _SPI_current->processed = queryDesc->estate->es_processed;
        _SPI_current->lastoid = queryDesc->estate->es_lastoid;
  
!       if (operation == CMD_SELECT && queryDesc->dest->mydest == DestSPI)
        {
                if (_SPI_checktuples())
                        elog(ERROR, "consistency check on SPI tuple count 
failed");
***************
*** 1646,1652 ****
         */
        _SPI_current->processed = nfetched;
  
!       if (dest->mydest == SPI && _SPI_checktuples())
                elog(ERROR, "consistency check on SPI tuple count failed");
  
        /* Put the result into place for access by caller */
--- 1646,1652 ----
         */
        _SPI_current->processed = nfetched;
  
!       if (dest->mydest == DestSPI && _SPI_checktuples())
                elog(ERROR, "consistency check on SPI tuple count failed");
  
        /* Put the result into place for access by caller */
Index: src/backend/executor/tstoreReceiver.c
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/executor/tstoreReceiver.c,v
retrieving revision 1.14
diff -c -r1.14 tstoreReceiver.c
*** src/backend/executor/tstoreReceiver.c       16 Mar 2005 21:38:08 -0000      
1.14
--- src/backend/executor/tstoreReceiver.c       2 Nov 2005 12:19:45 -0000
***************
*** 81,87 ****
        self->pub.rStartup = tstoreStartupReceiver;
        self->pub.rShutdown = tstoreShutdownReceiver;
        self->pub.rDestroy = tstoreDestroyReceiver;
!       self->pub.mydest = Tuplestore;
  
        self->tstore = tStore;
        self->cxt = tContext;
--- 81,87 ----
        self->pub.rStartup = tstoreStartupReceiver;
        self->pub.rShutdown = tstoreShutdownReceiver;
        self->pub.rDestroy = tstoreDestroyReceiver;
!       self->pub.mydest = DestTuplestore;
  
        self->tstore = tStore;
        self->cxt = tContext;
Index: src/backend/postmaster/postmaster.c
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/postmaster/postmaster.c,v
retrieving revision 1.472
diff -c -r1.472 postmaster.c
*** src/backend/postmaster/postmaster.c 22 Oct 2005 14:27:28 -0000      1.472
--- src/backend/postmaster/postmaster.c 2 Nov 2005 12:50:14 -0000
***************
*** 906,918 ****
        SysLoggerPID = SysLogger_Start();
  
        /*
!        * Reset whereToSendOutput from Debug (its starting state) to None. 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;
  
        /*
         * Initialize the statistics collector stuff
--- 906,918 ----
        SysLoggerPID = SysLogger_Start();
  
        /*
!        * 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 = DestNone;
  
        /*
         * Initialize the statistics collector stuff
***************
*** 2654,2660 ****
         * 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 */
  
        /*
         * We arrange for a simple exit(0) if we receive SIGTERM or SIGQUIT 
during
--- 2654,2660 ----
         * Must do this now because authentication uses libpq to send messages.
         */
        pq_init();                                      /* initialize libpq to 
talk to client */
!       whereToSendOutput = DestRemote; /* now safe to ereport to client */
  
        /*
         * We arrange for a simple exit(0) if we receive SIGTERM or SIGQUIT 
during
Index: src/backend/tcop/dest.c
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/tcop/dest.c,v
retrieving revision 1.66
diff -c -r1.66 dest.c
*** src/backend/tcop/dest.c     15 Oct 2005 02:49:26 -0000      1.66
--- src/backend/tcop/dest.c     2 Nov 2005 12:51:38 -0000
***************
*** 62,81 ****
   */
  static DestReceiver donothingDR = {
        donothingReceive, donothingStartup, donothingCleanup, donothingCleanup,
!       None
  };
  
  static DestReceiver debugtupDR = {
        debugtup, debugStartup, donothingCleanup, donothingCleanup,
!       Debug
  };
  
  static DestReceiver spi_printtupDR = {
        spi_printtup, spi_dest_startup, donothingCleanup, donothingCleanup,
!       SPI
  };
  
! /* Globally available receiver for None */
  DestReceiver *None_Receiver = &donothingDR;
  
  
--- 62,81 ----
   */
  static DestReceiver donothingDR = {
        donothingReceive, donothingStartup, donothingCleanup, donothingCleanup,
!       DestNone
  };
  
  static DestReceiver debugtupDR = {
        debugtup, debugStartup, donothingCleanup, donothingCleanup,
!       DestDebug
  };
  
  static DestReceiver spi_printtupDR = {
        spi_printtup, spi_dest_startup, donothingCleanup, donothingCleanup,
!       DestSPI
  };
  
! /* Globally available receiver for DestNone */
  DestReceiver *None_Receiver = &donothingDR;
  
  
***************
*** 92,99 ****
  /* ----------------
   *            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.
   * ----------------
   */
  DestReceiver *
--- 92,99 ----
  /* ----------------
   *            CreateDestReceiver - return appropriate receiver function set 
for dest
   *
!  * Note: a Portal must be specified for destinations DestRemote,
!  * DestRemoteExecute, and DestTuplestore.  It can be NULL for the others.
   * ----------------
   */
  DestReceiver *
***************
*** 101,124 ****
  {
        switch (dest)
        {
!               case Remote:
!               case RemoteExecute:
                        if (portal == NULL)
!                               elog(ERROR, "no portal specified for Remote 
receiver");
                        return printtup_create_DR(dest, portal);
  
!               case None:
                        return &donothingDR;
  
!               case Debug:
                        return &debugtupDR;
  
!               case SPI:
                        return &spi_printtupDR;
  
!               case Tuplestore:
                        if (portal == NULL)
!                               elog(ERROR, "no portal specified for Tuplestore 
receiver");
                        if (portal->holdStore == NULL ||
                                portal->holdContext == NULL)
                                elog(ERROR, "portal has no holdStore");
--- 101,124 ----
  {
        switch (dest)
        {
!               case DestRemote:
!               case DestRemoteExecute:
                        if (portal == NULL)
!                               elog(ERROR, "no portal specified for DestRemote 
receiver");
                        return printtup_create_DR(dest, portal);
  
!               case DestNone:
                        return &donothingDR;
  
!               case DestDebug:
                        return &debugtupDR;
  
!               case DestSPI:
                        return &spi_printtupDR;
  
!               case DestTuplestore:
                        if (portal == NULL)
!                               elog(ERROR, "no portal specified for 
DestTuplestore receiver");
                        if (portal->holdStore == NULL ||
                                portal->holdContext == NULL)
                                elog(ERROR, "portal has no holdStore");
***************
*** 139,153 ****
  {
        switch (dest)
        {
!               case Remote:
!               case RemoteExecute:
                        pq_puttextmessage('C', commandTag);
                        break;
  
!               case None:
!               case Debug:
!               case SPI:
!               case Tuplestore:
                        break;
        }
  }
--- 139,153 ----
  {
        switch (dest)
        {
!               case DestRemote:
!               case DestRemoteExecute:
                        pq_puttextmessage('C', commandTag);
                        break;
  
!               case DestNone:
!               case DestDebug:
!               case DestSPI:
!               case DestTuplestore:
                        break;
        }
  }
***************
*** 169,176 ****
  {
        switch (dest)
        {
!               case Remote:
!               case RemoteExecute:
  
                        /*
                         * tell the fe that we saw an empty query string.  In 
protocols
--- 169,176 ----
  {
        switch (dest)
        {
!               case DestRemote:
!               case DestRemoteExecute:
  
                        /*
                         * tell the fe that we saw an empty query string.  In 
protocols
***************
*** 182,191 ****
                                pq_puttextmessage('I', "");
                        break;
  
!               case None:
!               case Debug:
!               case SPI:
!               case Tuplestore:
                        break;
        }
  }
--- 182,191 ----
                                pq_puttextmessage('I', "");
                        break;
  
!               case DestNone:
!               case DestDebug:
!               case DestSPI:
!               case DestTuplestore:
                        break;
        }
  }
***************
*** 206,213 ****
  {
        switch (dest)
        {
!               case Remote:
!               case RemoteExecute:
                        if (PG_PROTOCOL_MAJOR(FrontendProtocol) >= 3)
                        {
                                StringInfoData buf;
--- 206,213 ----
  {
        switch (dest)
        {
!               case DestRemote:
!               case DestRemoteExecute:
                        if (PG_PROTOCOL_MAJOR(FrontendProtocol) >= 3)
                        {
                                StringInfoData buf;
***************
*** 222,231 ****
                        pq_flush();
                        break;
  
!               case None:
!               case Debug:
!               case SPI:
!               case Tuplestore:
                        break;
        }
  }
--- 222,231 ----
                        pq_flush();
                        break;
  
!               case DestNone:
!               case DestDebug:
!               case DestSPI:
!               case DestTuplestore:
                        break;
        }
  }
Index: src/backend/tcop/postgres.c
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/tcop/postgres.c,v
retrieving revision 1.467
diff -c -r1.467 postgres.c
*** src/backend/tcop/postgres.c 20 Oct 2005 20:05:45 -0000      1.467
--- src/backend/tcop/postgres.c 2 Nov 2005 12:24:55 -0000
***************
*** 74,80 ****
  const char *debug_query_string; /* for pgmonitor and log_min_error_statement 
*/
  
  /* Note: whereToSendOutput is initialized for the bootstrap/standalone case */
! CommandDest whereToSendOutput = Debug;
  
  /* flag for logging end of session */
  bool          Log_disconnections = false;
--- 74,80 ----
  const char *debug_query_string; /* for pgmonitor and log_min_error_statement 
*/
  
  /* Note: whereToSendOutput is initialized for the bootstrap/standalone case */
! CommandDest whereToSendOutput = DestDebug;
  
  /* flag for logging end of session */
  bool          Log_disconnections = false;
***************
*** 404,410 ****
  {
        int                     result;
  
!       if (whereToSendOutput == Remote)
                result = SocketBackend(inBuf);
        else
                result = InteractiveBackend(inBuf);
--- 404,410 ----
  {
        int                     result;
  
!       if (whereToSendOutput == DestRemote)
                result = SocketBackend(inBuf);
        else
                result = InteractiveBackend(inBuf);
***************
*** 1364,1370 ****
        /*
         * Send ParseComplete.
         */
!       if (whereToSendOutput == Remote)
                pq_putemptymessage('1');
  
        if (save_log_statement_stats)
--- 1364,1370 ----
        /*
         * Send ParseComplete.
         */
!       if (whereToSendOutput == DestRemote)
                pq_putemptymessage('1');
  
        if (save_log_statement_stats)
***************
*** 1650,1656 ****
        /*
         * Send BindComplete.
         */
!       if (whereToSendOutput == Remote)
                pq_putemptymessage('2');
  }
  
--- 1650,1656 ----
        /*
         * Send BindComplete.
         */
!       if (whereToSendOutput == DestRemote)
                pq_putemptymessage('2');
  }
  
***************
*** 1678,1685 ****
  
        /* Adjust destination to tell printtup.c what to do */
        dest = whereToSendOutput;
!       if (dest == Remote)
!               dest = RemoteExecute;
  
        portal = GetPortalByName(portal_name);
        if (!PortalIsValid(portal))
--- 1678,1685 ----
  
        /* Adjust destination to tell printtup.c what to do */
        dest = whereToSendOutput;
!       if (dest == DestRemote)
!               dest = DestRemoteExecute;
  
        portal = GetPortalByName(portal_name);
        if (!PortalIsValid(portal))
***************
*** 1835,1841 ****
        else
        {
                /* Portal run not complete, so send PortalSuspended */
!               if (whereToSendOutput == Remote)
                        pq_putemptymessage('s');
        }
  
--- 1835,1841 ----
        else
        {
                /* Portal run not complete, so send PortalSuspended */
!               if (whereToSendOutput == DestRemote)
                        pq_putemptymessage('s');
        }
  
***************
*** 1913,1919 ****
                                         errmsg("unnamed prepared statement 
does not exist")));
        }
  
!       if (whereToSendOutput != Remote)
                return;                                 /* can't actually do 
anything... */
  
        /*
--- 1913,1919 ----
                                         errmsg("unnamed prepared statement 
does not exist")));
        }
  
!       if (whereToSendOutput != DestRemote)
                return;                                 /* can't actually do 
anything... */
  
        /*
***************
*** 1959,1965 ****
                                (errcode(ERRCODE_UNDEFINED_CURSOR),
                                 errmsg("portal \"%s\" does not exist", 
portal_name)));
  
!       if (whereToSendOutput != Remote)
                return;                                 /* can't actually do 
anything... */
  
        if (portal->tupDesc)
--- 1959,1965 ----
                                (errcode(ERRCODE_UNDEFINED_CURSOR),
                                 errmsg("portal \"%s\" does not exist", 
portal_name)));
  
!       if (whereToSendOutput != DestRemote)
                return;                                 /* can't actually do 
anything... */
  
        if (portal->tupDesc)
***************
*** 2938,2944 ****
        /*
         * Send this backend's cancellation info to the frontend.
         */
!       if (whereToSendOutput == Remote &&
                PG_PROTOCOL_MAJOR(FrontendProtocol) >= 2)
        {
                StringInfoData buf;
--- 2938,2944 ----
        /*
         * Send this backend's cancellation info to the frontend.
         */
!       if (whereToSendOutput == DestRemote &&
                PG_PROTOCOL_MAJOR(FrontendProtocol) >= 2)
        {
                StringInfoData buf;
***************
*** 2951,2957 ****
        }
  
        /* Welcome banner for standalone case */
!       if (whereToSendOutput == Debug)
                printf("\nPostgreSQL stand-alone backend %s\n", PG_VERSION);
  
        /*
--- 2951,2957 ----
        }
  
        /* Welcome banner for standalone case */
!       if (whereToSendOutput == DestDebug)
                printf("\nPostgreSQL stand-alone backend %s\n", PG_VERSION);
  
        /*
***************
*** 3239,3246 ****
                                         * Reset whereToSendOutput to prevent 
ereport from
                                         * attempting to send any more messages 
to client.
                                         */
!                                       if (whereToSendOutput == Remote)
!                                               whereToSendOutput = None;
  
                                        proc_exit(0);
                                }
--- 3239,3246 ----
                                         * Reset whereToSendOutput to prevent 
ereport from
                                         * attempting to send any more messages 
to client.
                                         */
!                                       if (whereToSendOutput == DestRemote)
!                                               whereToSendOutput = DestNone;
  
                                        proc_exit(0);
                                }
***************
*** 3294,3300 ****
                                                        break;
                                        }
  
!                                       if (whereToSendOutput == Remote)
                                                pq_putemptymessage('3');        
        /* CloseComplete */
                                }
                                break;
--- 3294,3300 ----
                                                        break;
                                        }
  
!                                       if (whereToSendOutput == DestRemote)
                                                pq_putemptymessage('3');        
        /* CloseComplete */
                                }
                                break;
***************
*** 3328,3334 ****
  
                        case 'H':                       /* flush */
                                pq_getmsgend(&input_message);
!                               if (whereToSendOutput == Remote)
                                        pq_flush();
                                break;
  
--- 3328,3334 ----
  
                        case 'H':                       /* flush */
                                pq_getmsgend(&input_message);
!                               if (whereToSendOutput == DestRemote)
                                        pq_flush();
                                break;
  
***************
*** 3350,3357 ****
                                 * Reset whereToSendOutput to prevent ereport 
from attempting
                                 * to send any more messages to client.
                                 */
!                               if (whereToSendOutput == Remote)
!                                       whereToSendOutput = None;
  
                                /*
                                 * NOTE: if you are tempted to add more code 
here, DON'T!
--- 3350,3357 ----
                                 * Reset whereToSendOutput to prevent ereport 
from attempting
                                 * to send any more messages to client.
                                 */
!                               if (whereToSendOutput == DestRemote)
!                                       whereToSendOutput = DestNone;
  
                                /*
                                 * NOTE: if you are tempted to add more code 
here, DON'T!
Index: src/backend/tcop/pquery.c
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/tcop/pquery.c,v
retrieving revision 1.95
diff -c -r1.95 pquery.c
*** src/backend/tcop/pquery.c   15 Oct 2005 02:49:27 -0000      1.95
--- src/backend/tcop/pquery.c   2 Nov 2005 12:53:13 -0000
***************
*** 471,478 ****
   *            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.
   *
   * formats[] is the client format request, as per Bind message conventions.
   */
--- 471,478 ----
   *            Select the format codes for a portal's output.
   *
   * This must be run after PortalStart for a portal that will be read by
!  * 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.
   */
***************
*** 633,639 ****
                                        DestReceiver *treceiver;
  
                                        PortalCreateHoldStore(portal);
!                                       treceiver = 
CreateDestReceiver(Tuplestore, portal);
                                        PortalRunUtility(portal, 
linitial(portal->parseTrees),
                                                                         
treceiver, NULL);
                                        (*treceiver->rDestroy) (treceiver);
--- 633,639 ----
                                        DestReceiver *treceiver;
  
                                        PortalCreateHoldStore(portal);
!                                       treceiver = 
CreateDestReceiver(DestTuplestore, portal);
                                        PortalRunUtility(portal, 
linitial(portal->parseTrees),
                                                                         
treceiver, NULL);
                                        (*treceiver->rDestroy) (treceiver);
***************
*** 1015,1032 ****
        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
         * 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)
                dest = None_Receiver;
!       if (altdest->mydest == RemoteExecute)
                altdest = None_Receiver;
  
        /*
--- 1015,1032 ----
        ListCell   *planlist_item;
  
        /*
!        * 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 == DestRemoteExecute)
                dest = None_Receiver;
!       if (altdest->mydest == DestRemoteExecute)
                altdest = None_Receiver;
  
        /*
***************
*** 1184,1190 ****
                                        DestReceiver *treceiver;
  
                                        PortalCreateHoldStore(portal);
!                                       treceiver = 
CreateDestReceiver(Tuplestore, portal);
                                        PortalRunUtility(portal, 
linitial(portal->parseTrees),
                                                                         
treceiver, NULL);
                                        (*treceiver->rDestroy) (treceiver);
--- 1184,1190 ----
                                        DestReceiver *treceiver;
  
                                        PortalCreateHoldStore(portal);
!                                       treceiver = 
CreateDestReceiver(DestTuplestore, portal);
                                        PortalRunUtility(portal, 
linitial(portal->parseTrees),
                                                                         
treceiver, NULL);
                                        (*treceiver->rDestroy) (treceiver);
***************
*** 1371,1377 ****
                /* Are we sitting on a row? */
                on_row = (!portal->atStart && !portal->atEnd);
  
!               if (dest->mydest == None)
                {
                        /* MOVE 0 returns 0/1 based on if FETCH 0 would return 
a row */
                        return on_row ? 1L : 0L;
--- 1371,1377 ----
                /* Are we sitting on a row? */
                on_row = (!portal->atStart && !portal->atEnd);
  
!               if (dest->mydest == DestNone)
                {
                        /* MOVE 0 returns 0/1 based on if FETCH 0 would return 
a row */
                        return on_row ? 1L : 0L;
***************
*** 1398,1404 ****
        /*
         * Optimize MOVE BACKWARD ALL into a Rewind.
         */
!       if (!forward && count == FETCH_ALL && dest->mydest == None)
        {
                long            result = portal->portalPos;
  
--- 1398,1404 ----
        /*
         * Optimize MOVE BACKWARD ALL into a Rewind.
         */
!       if (!forward && count == FETCH_ALL && dest->mydest == DestNone)
        {
                long            result = portal->portalPos;
  
Index: src/backend/utils/error/elog.c
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/utils/error/elog.c,v
retrieving revision 1.165
diff -c -r1.165 elog.c
*** src/backend/utils/error/elog.c      15 Oct 2005 02:49:32 -0000      1.165
--- src/backend/utils/error/elog.c      2 Nov 2005 12:30:28 -0000
***************
*** 223,229 ****
        }
  
        /* Determine whether message is enabled for client output */
!       if (whereToSendOutput == Remote && elevel != COMMERROR)
        {
                /*
                 * client_min_messages is honored only after we complete the
--- 223,229 ----
        }
  
        /* Determine whether message is enabled for client output */
!       if (whereToSendOutput == DestRemote && elevel != COMMERROR)
        {
                /*
                 * client_min_messages is honored only after we complete the
***************
*** 374,380 ****
         * 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)
                pq_endcopyout(true);
  
        /* Emit the message to the right places */
--- 374,380 ----
         * 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 == DestRemote)
                pq_endcopyout(true);
  
        /* Emit the message to the right places */
***************
*** 412,419 ****
                 * 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;
  
                /*
                 * fflush here is just to improve the odds that we get to see 
the
--- 412,419 ----
                 * 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 == 
DestRemote)
!                       whereToSendOutput = DestNone;
  
                /*
                 * fflush here is just to improve the odds that we get to see 
the
***************
*** 1684,1690 ****
  #endif   /* WIN32 */
  
        /* Write to stderr, if enabled */
!       if ((Log_destination & LOG_DESTINATION_STDERR) || whereToSendOutput == 
Debug)
        {
  #ifdef WIN32
  
--- 1684,1690 ----
  #endif   /* WIN32 */
  
        /* Write to stderr, if enabled */
!       if ((Log_destination & LOG_DESTINATION_STDERR) || whereToSendOutput == 
DestDebug)
        {
  #ifdef WIN32
  
Index: src/backend/utils/misc/guc.c
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/utils/misc/guc.c,v
retrieving revision 1.296
diff -c -r1.296 guc.c
*** src/backend/utils/misc/guc.c        29 Oct 2005 00:31:52 -0000      1.296
--- src/backend/utils/misc/guc.c        2 Nov 2005 12:31:11 -0000
***************
*** 3323,3329 ****
         * Don't do anything unless talking to an interactive frontend of 
protocol
         * 3.0 or later.
         */
!       if (whereToSendOutput != Remote ||
                PG_PROTOCOL_MAJOR(FrontendProtocol) < 3)
                return;
  
--- 3323,3329 ----
         * Don't do anything unless talking to an interactive frontend of 
protocol
         * 3.0 or later.
         */
!       if (whereToSendOutput != DestRemote ||
                PG_PROTOCOL_MAJOR(FrontendProtocol) < 3)
                return;
  
Index: src/include/tcop/dest.h
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/include/tcop/dest.h,v
retrieving revision 1.47
diff -c -r1.47 dest.h
*** src/include/tcop/dest.h     15 Oct 2005 02:49:46 -0000      1.47
--- src/include/tcop/dest.h     2 Nov 2005 12:48:15 -0000
***************
*** 15,21 ****
   *            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
   *            a query internally.  The results are discarded.
   *
   * dest.c defines three functions that implement destination management:
--- 15,21 ----
   *            PQexec() or PQfn().  In this case, the results are sent
   *            to the frontend via the functions in backend/libpq.
   *
!  *      - DestNone is the destination when the system executes
   *            a query internally.  The results are discarded.
   *
   * dest.c defines three functions that implement destination management:
***************
*** 47,53 ****
   * 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
   * calls in portal and cursor manipulations.
   *
   *
--- 47,53 ----
   * object not to disappear while still needed.
   *
   * Special provision: None_Receiver is a permanently available receiver
!  * object for the DestNone destination.  This avoids useless creation/destroy
   * calls in portal and cursor manipulations.
   *
   *
***************
*** 72,90 ****
   *            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
   * 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 */
  } CommandDest;
  
  /* ----------------
--- 72,90 ----
   *            CommandDest is a simplistic means of identifying the desired
   *            destination.  Someday this will probably need to be improved.
   *
!  * 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
  {
!       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;
  
  /* ----------------
***************
*** 115,121 ****
        /* Private fields might appear beyond this point... */
  };
  
! extern DestReceiver *None_Receiver;           /* permanent receiver for None 
*/
  
  /* This is a forward reference to utils/portal.h */
  
--- 115,121 ----
        /* Private fields might appear beyond this point... */
  };
  
! extern DestReceiver *None_Receiver;           /* permanent receiver for 
DestNone */
  
  /* This is a forward reference to utils/portal.h */
  
---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

Reply via email to