|
13 | 13 | * Portions Copyright (c) 1994, Regents of the University of California
|
14 | 14 | *
|
15 | 15 | * IDENTIFICATION
|
16 |
| - * $PostgreSQL: pgsql/src/backend/catalog/namespace.c,v 1.127 2010/08/05 15:25:35 rhaas Exp $ |
| 16 | + * $PostgreSQL: pgsql/src/backend/catalog/namespace.c,v 1.128 2010/08/13 16:27:11 tgl Exp $ |
17 | 17 | *
|
18 | 18 | *-------------------------------------------------------------------------
|
19 | 19 | */
|
@@ -2667,6 +2667,17 @@ GetOverrideSearchPath(MemoryContext context)
|
2667 | 2667 | *
|
2668 | 2668 | * We allow nested overrides, hence the push/pop terminology. The GUC
|
2669 | 2669 | * search_path variable is ignored while an override is active.
|
| 2670 | + * |
| 2671 | + * It's possible that newpath->useTemp is set but there is no longer any |
| 2672 | + * active temp namespace, if the path was saved during a transaction that |
| 2673 | + * created a temp namespace and was later rolled back. In that case we just |
| 2674 | + * ignore useTemp. A plausible alternative would be to create a new temp |
| 2675 | + * namespace, but for existing callers that's not necessary because an empty |
| 2676 | + * temp namespace wouldn't affect their results anyway. |
| 2677 | + * |
| 2678 | + * It's also worth noting that other schemas listed in newpath might not |
| 2679 | + * exist anymore either. We don't worry about this because OIDs that match |
| 2680 | + * no existing namespace will simply not produce any hits during searches. |
2670 | 2681 | */
|
2671 | 2682 | void
|
2672 | 2683 | PushOverrideSearchPath(OverrideSearchPath *newpath)
|
@@ -2700,11 +2711,8 @@ PushOverrideSearchPath(OverrideSearchPath *newpath)
|
2700 | 2711 | if (newpath->addCatalog)
|
2701 | 2712 | oidlist = lcons_oid(PG_CATALOG_NAMESPACE, oidlist);
|
2702 | 2713 |
|
2703 |
| - if (newpath->addTemp) |
2704 |
| - { |
2705 |
| - Assert(OidIsValid(myTempNamespace)); |
| 2714 | + if (newpath->addTemp && OidIsValid(myTempNamespace)) |
2706 | 2715 | oidlist = lcons_oid(myTempNamespace, oidlist);
|
2707 |
| - } |
2708 | 2716 |
|
2709 | 2717 | /*
|
2710 | 2718 | * Build the new stack entry, then insert it at the head of the list.
|
|
0 commit comments