summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/catalog/namespace.c18
-rw-r--r--src/backend/utils/cache/plancache.c4
2 files changed, 16 insertions, 6 deletions
diff --git a/src/backend/catalog/namespace.c b/src/backend/catalog/namespace.c
index 1383d1e2afd..ff302706402 100644
--- a/src/backend/catalog/namespace.c
+++ b/src/backend/catalog/namespace.c
@@ -13,7 +13,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/namespace.c,v 1.104 2008/01/01 19:45:48 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/namespace.c,v 1.104.2.1 2010/08/13 16:27:35 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -2264,6 +2264,17 @@ GetOverrideSearchPath(MemoryContext context)
*
* We allow nested overrides, hence the push/pop terminology. The GUC
* search_path variable is ignored while an override is active.
+ *
+ * It's possible that newpath->useTemp is set but there is no longer any
+ * active temp namespace, if the path was saved during a transaction that
+ * created a temp namespace and was later rolled back. In that case we just
+ * ignore useTemp. A plausible alternative would be to create a new temp
+ * namespace, but for existing callers that's not necessary because an empty
+ * temp namespace wouldn't affect their results anyway.
+ *
+ * It's also worth noting that other schemas listed in newpath might not
+ * exist anymore either. We don't worry about this because OIDs that match
+ * no existing namespace will simply not produce any hits during searches.
*/
void
PushOverrideSearchPath(OverrideSearchPath *newpath)
@@ -2297,11 +2308,8 @@ PushOverrideSearchPath(OverrideSearchPath *newpath)
if (newpath->addCatalog)
oidlist = lcons_oid(PG_CATALOG_NAMESPACE, oidlist);
- if (newpath->addTemp)
- {
- Assert(OidIsValid(myTempNamespace));
+ if (newpath->addTemp && OidIsValid(myTempNamespace))
oidlist = lcons_oid(myTempNamespace, oidlist);
- }
/*
* Build the new stack entry, then insert it at the head of the list.
diff --git a/src/backend/utils/cache/plancache.c b/src/backend/utils/cache/plancache.c
index 1742fa618c3..b3aaa066134 100644
--- a/src/backend/utils/cache/plancache.c
+++ b/src/backend/utils/cache/plancache.c
@@ -33,7 +33,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/cache/plancache.c,v 1.15.2.3 2009/07/14 15:38:03 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/cache/plancache.c,v 1.15.2.4 2010/08/13 16:27:35 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -462,6 +462,8 @@ RevalidateCachedPlan(CachedPlanSource *plansource, bool useResOwner)
/*
* Restore the search_path that was in use when the plan was made.
+ * See comments for PushOverrideSearchPath about limitations of this.
+ *
* (XXX is there anything else we really need to restore?)
*/
PushOverrideSearchPath(plansource->search_path);