aboutsummaryrefslogtreecommitdiff
path: root/src/backend/tcop/postgres.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-07-04 06:11:54 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-07-04 06:11:54 +0000
commitcdeca5f590cc3c336c9c217831d68a2ca7f15265 (patch)
treef233f7ae62023950d1c169530b83f705c63ceed0 /src/backend/tcop/postgres.c
parent9cf327790d978fc4ec6dba1c7f456e0a7596e4e2 (diff)
downloadpostgresql-cdeca5f590cc3c336c9c217831d68a2ca7f15265.tar.gz
postgresql-cdeca5f590cc3c336c9c217831d68a2ca7f15265.zip
Make toast-table creation and deletion work somewhat reliably.
Don't go through pg_exec_query_dest(), but directly to the execution routines. Also, extend parameter lists so that there's no need to change the global setting of allowSystemTableMods, a hack that was certain to cause trouble in the event of any error.
Diffstat (limited to 'src/backend/tcop/postgres.c')
-rw-r--r--src/backend/tcop/postgres.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index b034442eaff..3843ce7a2d4 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.165 2000/07/03 20:48:37 petere Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.166 2000/07/04 06:11:43 tgl Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
@@ -538,7 +538,7 @@ pg_plan_query(Query *querytree)
*
* parse_context references a context suitable for holding the
* parse/rewrite trees (typically this will be QueryContext).
- * This context must be longer-lived than the CurrentMemoryContext!
+ * This context *must* be longer-lived than the CurrentMemoryContext!
* In fact, if the query string might contain BEGIN/COMMIT commands,
* parse_context had better outlive TopTransactionContext!
*
@@ -560,6 +560,16 @@ pg_exec_query_dest(char *query_string, /* string to execute */
*querytree_item;
/*
+ * If you called this routine with parse_context = CurrentMemoryContext,
+ * you blew it. They *must* be different, else the context reset
+ * at the bottom of the loop will destroy the querytree list.
+ * (We really ought to check that parse_context isn't a child of
+ * CurrentMemoryContext either, but that would take more cycles than
+ * it's likely to be worth.)
+ */
+ Assert(parse_context != CurrentMemoryContext);
+
+ /*
* Switch to appropriate context for constructing parsetrees.
*/
oldcontext = MemoryContextSwitchTo(parse_context);
@@ -1404,7 +1414,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
if (!IsUnderPostmaster)
{
puts("\nPOSTGRES backend interactive interface ");
- puts("$Revision: 1.165 $ $Date: 2000/07/03 20:48:37 $\n");
+ puts("$Revision: 1.166 $ $Date: 2000/07/04 06:11:43 $\n");
}
/*