1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-03 15:22:11 +03:00

Restructure command-completion-report code so that there is just one

report for each received SQL command, regardless of rewriting activity.
Also ensure that this report comes from the 'original' command, not the
last command generated by rewrite; this fixes 7.2 breakage for INSERT
commands that have actions added by rules.  Fernando Nasser and Tom Lane.
This commit is contained in:
Tom Lane
2002-02-26 22:47:12 +00:00
parent f71dc6d0e2
commit 56ee2ecba9
17 changed files with 504 additions and 272 deletions

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/dest.c,v 1.46 2001/10/28 06:25:51 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/dest.c,v 1.47 2002/02/26 22:47:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -41,8 +41,6 @@
#include "libpq/pqformat.h"
static char CommandInfo[32] = {0};
/* ----------------
* dummy DestReceiver functions
* ----------------
@@ -102,7 +100,6 @@ BeginCommand(char *pname,
* if this is a "retrieve into portal" query, done because
* nothing needs to be sent to the fe.
*/
CommandInfo[0] = '\0';
if (isIntoPortal)
break;
@@ -198,30 +195,22 @@ DestToFunction(CommandDest dest)
}
/* ----------------
* EndCommand - tell destination that no more tuples will arrive
* EndCommand - tell destination that query is complete
* ----------------
*/
void
EndCommand(char *commandTag, CommandDest dest)
EndCommand(const char *commandTag, CommandDest dest)
{
char buf[64];
switch (dest)
{
case Remote:
case RemoteInternal:
/*
* tell the fe that the query is over
*/
sprintf(buf, "%s%s", commandTag, CommandInfo);
pq_puttextmessage('C', buf);
CommandInfo[0] = '\0';
pq_puttextmessage('C', commandTag);
break;
case Debug:
case None:
default:
case Debug:
case SPI:
break;
}
}
@@ -317,23 +306,3 @@ ReadyForQuery(CommandDest dest)
break;
}
}
void
UpdateCommandInfo(int operation, Oid lastoid, uint32 tuples)
{
switch (operation)
{
case CMD_INSERT:
if (tuples > 1)
lastoid = InvalidOid;
sprintf(CommandInfo, " %u %u", lastoid, tuples);
break;
case CMD_DELETE:
case CMD_UPDATE:
sprintf(CommandInfo, " %u", tuples);
break;
default:
CommandInfo[0] = '\0';
break;
}
}