Skip to content

Commit 9495294

Browse files
committed
Second thoughts about where to put DeferredTriggerEndQuery() call.
1 parent fbd26d6 commit 9495294

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

src/backend/tcop/postgres.c

Lines changed: 12 additions & 13 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.178 2000/10/07 00:58:18 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.179 2000/10/07 04:00:41 tgl Exp $
1212
*
1313
* NOTES
1414
* this is the "main" module of the postgres backend and
@@ -597,18 +597,17 @@ pg_plan_query(Query *querytree)
597597
*
598598
* Assumptions:
599599
*
600-
* Caller is responsible for calling StartTransactionCommand() beforehand
601-
* and CommitTransactionCommand() afterwards (if successful).
600+
* At call, we are not inside a transaction command.
602601
*
603-
* The CurrentMemoryContext at entry references a context that is
602+
* The CurrentMemoryContext after starting a transaction command must be
604603
* appropriate for execution of individual queries (typically this will be
605604
* TransactionCommandContext). Note that this routine resets that context
606605
* after each individual query, so don't store anything there that
607606
* must outlive the call!
608607
*
609608
* parse_context references a context suitable for holding the
610609
* parse/rewrite trees (typically this will be QueryContext).
611-
* This context *must* be longer-lived than the CurrentMemoryContext!
610+
* This context *must* be longer-lived than the transaction context!
612611
* In fact, if the query string might contain BEGIN/COMMIT commands,
613612
* parse_context had better outlive TopTransactionContext!
614613
*
@@ -635,7 +634,7 @@ pg_exec_query_string(char *query_string, /* string to execute */
635634
* query_string will be in this same command block, *unless* we find
636635
* a BEGIN/COMMIT/ABORT statement; we have to force a new xact command
637636
* after one of those, else bad things will happen in xact.c.
638-
* (Note that this will possibly change execution memory context.)
637+
* (Note that this will possibly change current memory context.)
639638
*/
640639
start_xact_command();
641640
xact_started = true;
@@ -837,11 +836,6 @@ pg_exec_query_string(char *query_string, /* string to execute */
837836
if (!isTransactionStmt)
838837
CommandCounterIncrement();
839838

840-
/*
841-
* Invoke IMMEDIATE constraint triggers
842-
*/
843-
DeferredTriggerEndQuery();
844-
845839
/*
846840
* Clear the execution context to recover temporary
847841
* memory used by the query. NOTE: if query string contains
@@ -888,12 +882,17 @@ start_xact_command(void)
888882
static void
889883
finish_xact_command(void)
890884
{
885+
/* Invoke IMMEDIATE constraint triggers */
886+
DeferredTriggerEndQuery();
887+
888+
/* Now commit the command */
891889
if (DebugLvl >= 1)
892890
elog(DEBUG, "CommitTransactionCommand");
893891
set_ps_display("commit"); /* XXX probably the wrong place to do this */
894892
CommitTransactionCommand();
893+
895894
#ifdef SHOW_MEMORY_STATS
896-
/* print mem stats at each commit for leak tracking */
895+
/* Print mem stats at each commit for leak tracking */
897896
if (ShowStats)
898897
MemoryContextStats(TopMemoryContext);
899898
#endif
@@ -1614,7 +1613,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
16141613
if (!IsUnderPostmaster)
16151614
{
16161615
puts("\nPOSTGRES backend interactive interface ");
1617-
puts("$Revision: 1.178 $ $Date: 2000/10/07 00:58:18 $\n");
1616+
puts("$Revision: 1.179 $ $Date: 2000/10/07 04:00:41 $\n");
16181617
}
16191618

16201619
/*

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy