8
8
*
9
9
*
10
10
* 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 $
12
12
*
13
13
* NOTES
14
14
* this is the "main" module of the postgres backend and
@@ -597,18 +597,17 @@ pg_plan_query(Query *querytree)
597
597
*
598
598
* Assumptions:
599
599
*
600
- * Caller is responsible for calling StartTransactionCommand() beforehand
601
- * and CommitTransactionCommand() afterwards (if successful).
600
+ * At call, we are not inside a transaction command.
602
601
*
603
- * The CurrentMemoryContext at entry references a context that is
602
+ * The CurrentMemoryContext after starting a transaction command must be
604
603
* appropriate for execution of individual queries (typically this will be
605
604
* TransactionCommandContext). Note that this routine resets that context
606
605
* after each individual query, so don't store anything there that
607
606
* must outlive the call!
608
607
*
609
608
* parse_context references a context suitable for holding the
610
609
* 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 !
612
611
* In fact, if the query string might contain BEGIN/COMMIT commands,
613
612
* parse_context had better outlive TopTransactionContext!
614
613
*
@@ -635,7 +634,7 @@ pg_exec_query_string(char *query_string, /* string to execute */
635
634
* query_string will be in this same command block, *unless* we find
636
635
* a BEGIN/COMMIT/ABORT statement; we have to force a new xact command
637
636
* 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.)
639
638
*/
640
639
start_xact_command ();
641
640
xact_started = true;
@@ -837,11 +836,6 @@ pg_exec_query_string(char *query_string, /* string to execute */
837
836
if (!isTransactionStmt )
838
837
CommandCounterIncrement ();
839
838
840
- /*
841
- * Invoke IMMEDIATE constraint triggers
842
- */
843
- DeferredTriggerEndQuery ();
844
-
845
839
/*
846
840
* Clear the execution context to recover temporary
847
841
* memory used by the query. NOTE: if query string contains
@@ -888,12 +882,17 @@ start_xact_command(void)
888
882
static void
889
883
finish_xact_command (void )
890
884
{
885
+ /* Invoke IMMEDIATE constraint triggers */
886
+ DeferredTriggerEndQuery ();
887
+
888
+ /* Now commit the command */
891
889
if (DebugLvl >= 1 )
892
890
elog (DEBUG , "CommitTransactionCommand" );
893
891
set_ps_display ("commit" ); /* XXX probably the wrong place to do this */
894
892
CommitTransactionCommand ();
893
+
895
894
#ifdef SHOW_MEMORY_STATS
896
- /* print mem stats at each commit for leak tracking */
895
+ /* Print mem stats at each commit for leak tracking */
897
896
if (ShowStats )
898
897
MemoryContextStats (TopMemoryContext );
899
898
#endif
@@ -1614,7 +1613,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
1614
1613
if (!IsUnderPostmaster )
1615
1614
{
1616
1615
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" );
1618
1617
}
1619
1618
1620
1619
/*
0 commit comments