This patch makes the EXECUTE command's completion tag return the

completion tag of the actual statement executed.  This allows the
correct update count to be returned for UPDATE/INSERT/DELETE
statements.

Kris Jurka
This commit is contained in:
Bruce Momjian 2004-04-22 02:58:21 +00:00
parent ec7c4c1b66
commit 914042fe5f
3 changed files with 8 additions and 7 deletions

View File

@ -10,7 +10,7 @@
* Copyright (c) 2002-2003, PostgreSQL Global Development Group * Copyright (c) 2002-2003, PostgreSQL Global Development Group
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/prepare.c,v 1.25 2004/01/07 18:56:25 neilc Exp $ * $PostgreSQL: pgsql/src/backend/commands/prepare.c,v 1.26 2004/04/22 02:58:20 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -106,7 +106,7 @@ PrepareQuery(PrepareStmt *stmt)
* Implements the 'EXECUTE' utility statement. * Implements the 'EXECUTE' utility statement.
*/ */
void void
ExecuteQuery(ExecuteStmt *stmt, DestReceiver *dest) ExecuteQuery(ExecuteStmt *stmt, DestReceiver *dest, char *completionTag)
{ {
PreparedStatement *entry; PreparedStatement *entry;
char *query_string; char *query_string;
@ -188,7 +188,7 @@ ExecuteQuery(ExecuteStmt *stmt, DestReceiver *dest)
*/ */
PortalStart(portal, paramLI); PortalStart(portal, paramLI);
(void) PortalRun(portal, FETCH_ALL, dest, dest, NULL); (void) PortalRun(portal, FETCH_ALL, dest, dest, completionTag);
PortalDrop(portal, false); PortalDrop(portal, false);

View File

@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/tcop/utility.c,v 1.212 2004/04/19 21:21:33 momjian Exp $ * $PostgreSQL: pgsql/src/backend/tcop/utility.c,v 1.213 2004/04/22 02:58:20 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -483,7 +483,7 @@ ProcessUtility(Node *parsetree,
break; break;
case T_ExecuteStmt: case T_ExecuteStmt:
ExecuteQuery((ExecuteStmt *) parsetree, dest); ExecuteQuery((ExecuteStmt *) parsetree, dest, completionTag);
break; break;
case T_DeallocateStmt: case T_DeallocateStmt:

View File

@ -6,7 +6,7 @@
* *
* Copyright (c) 2002-2003, PostgreSQL Global Development Group * Copyright (c) 2002-2003, PostgreSQL Global Development Group
* *
* $PostgreSQL: pgsql/src/include/commands/prepare.h,v 1.9 2003/11/29 22:40:59 pgsql Exp $ * $PostgreSQL: pgsql/src/include/commands/prepare.h,v 1.10 2004/04/22 02:58:21 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -42,7 +42,8 @@ typedef struct
/* Utility statements PREPARE, EXECUTE, DEALLOCATE, EXPLAIN EXECUTE */ /* Utility statements PREPARE, EXECUTE, DEALLOCATE, EXPLAIN EXECUTE */
extern void PrepareQuery(PrepareStmt *stmt); extern void PrepareQuery(PrepareStmt *stmt);
extern void ExecuteQuery(ExecuteStmt *stmt, DestReceiver *dest); extern void ExecuteQuery(ExecuteStmt *stmt, DestReceiver *dest,
char *completionTag);
extern void DeallocateQuery(DeallocateStmt *stmt); extern void DeallocateQuery(DeallocateStmt *stmt);
extern void ExplainExecuteQuery(ExplainStmt *stmt, TupOutputState *tstate); extern void ExplainExecuteQuery(ExplainStmt *stmt, TupOutputState *tstate);