Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5240c76

Browse files
committed
Actually, that still wasn't quite right. If we skip a query because of
xact abort state in pg_exec_query_dest, we should continue scanning the querytree list, on the off chance that one of the later queries in the string is COMMIT or ROLLBACK.
1 parent 708f82f commit 5240c76

File tree

1 file changed

+11
-24
lines changed

1 file changed

+11
-24
lines changed

src/backend/tcop/postgres.c

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.149 2000/04/04 21:44:39 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.150 2000/04/04 23:52:50 tgl Exp $
1212
*
1313
* NOTES
1414
* this is the "main" module of the postgres backend and
@@ -150,19 +150,6 @@ int UseNewLine = 0; /* Use EOF as query delimiters */
150150
*/
151151
int XfuncMode = 0;
152152

153-
/*
154-
* ----------------
155-
* Note: _exec_repeat_ defaults to 1 but may be changed
156-
* by a DEBUG command. If you set this to a large
157-
* number N, run a single query, and then set it
158-
* back to 1 and run N queries, you can get an idea
159-
* of how much time is being spent in the parser and
160-
* planner b/c in the first case this overhead only
161-
* happens once. -cim 6/9/91
162-
* ----------------
163-
*/
164-
int _exec_repeat_ = 1;
165-
166153
/* ----------------------------------------------------------------
167154
* decls for routines only used in this file
168155
* ----------------------------------------------------------------
@@ -634,9 +621,8 @@ pg_exec_query_dest(char *query_string, /* string to execute */
634621
else
635622
{
636623
Plan *plan;
637-
int j;
638624

639-
/* If aborted transaction, quit now */
625+
/* If aborted transaction, skip planning and execution */
640626
if (IsAbortedTransactionBlockState())
641627
{
642628
/* ----------------
@@ -651,7 +637,11 @@ pg_exec_query_dest(char *query_string, /* string to execute */
651637

652638
EndCommand(tag, dest);
653639

654-
break;
640+
/* We continue in the loop, on the off chance that there
641+
* is a COMMIT or ROLLBACK utility command later in the
642+
* query string.
643+
*/
644+
continue;
655645
}
656646

657647
plan = pg_plan_query(querytree);
@@ -669,12 +659,9 @@ pg_exec_query_dest(char *query_string, /* string to execute */
669659
if (ShowExecutorStats)
670660
ResetUsage();
671661

672-
for (j = 0; j < _exec_repeat_; j++)
673-
{
674-
if (Verbose)
675-
TPRINTF(TRACE_VERBOSE, "ProcessQuery");
676-
ProcessQuery(querytree, plan, dest);
677-
}
662+
if (Verbose)
663+
TPRINTF(TRACE_VERBOSE, "ProcessQuery");
664+
ProcessQuery(querytree, plan, dest);
678665

679666
if (ShowExecutorStats)
680667
{
@@ -1462,7 +1449,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
14621449
if (!IsUnderPostmaster)
14631450
{
14641451
puts("\nPOSTGRES backend interactive interface ");
1465-
puts("$Revision: 1.149 $ $Date: 2000/04/04 21:44:39 $\n");
1452+
puts("$Revision: 1.150 $ $Date: 2000/04/04 23:52:50 $\n");
14661453
}
14671454

14681455
/*

0 commit comments

Comments
 (0)