diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2007-03-23 19:53:52 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2007-03-23 19:53:52 +0000 |
commit | 547b6e537aa8bbae83a8a4c4d0d7f216390bdb9c (patch) | |
tree | 0a8e84561de60017cdbcb2080aa444706c1af404 /src/backend/commands/schemacmds.c | |
parent | 4c35ec53a9e8e9c5496b2e33c6b568c0cfbdb7e3 (diff) |
Fix plancache so that any required replanning is done with the same
search_path that was active when the plan was first made. To do this,
improve namespace.c to support a stack of "override" search path settings
(we must have a stack since nested replan events are entirely possible).
This facility replaces the "special namespace" hack formerly used by
CREATE SCHEMA, and should be able to support per-function search path
settings as well.
Diffstat (limited to 'src/backend/commands/schemacmds.c')
-rw-r--r-- | src/backend/commands/schemacmds.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/backend/commands/schemacmds.c b/src/backend/commands/schemacmds.c index 0912b8a62cc..5a03c7780f3 100644 --- a/src/backend/commands/schemacmds.c +++ b/src/backend/commands/schemacmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/schemacmds.c,v 1.44 2007/03/13 00:33:39 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/schemacmds.c,v 1.45 2007/03/23 19:53:51 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -43,6 +43,7 @@ CreateSchemaCommand(CreateSchemaStmt *stmt, const char *queryString) const char *schemaName = stmt->schemaname; const char *authId = stmt->authid; Oid namespaceId; + OverrideSearchPath *overridePath; List *parsetree_list; ListCell *parsetree_item; Oid owner_uid; @@ -102,7 +103,10 @@ CreateSchemaCommand(CreateSchemaStmt *stmt, const char *queryString) * well as the default creation target namespace. This will be undone at * the end of this routine, or upon error. */ - PushSpecialNamespace(namespaceId); + overridePath = GetOverrideSearchPath(CurrentMemoryContext); + overridePath->schemas = lcons_oid(namespaceId, overridePath->schemas); + /* XXX should we clear overridePath->useTemp? */ + PushOverrideSearchPath(overridePath); /* * Examine the list of commands embedded in the CREATE SCHEMA command, and @@ -143,7 +147,7 @@ CreateSchemaCommand(CreateSchemaStmt *stmt, const char *queryString) } /* Reset search path to normal state */ - PopSpecialNamespace(namespaceId); + PopOverrideSearchPath(); /* Reset current user */ SetUserId(saved_uid); |