Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2a7349f

Browse files
committed
Fix Assert failure in PushOverrideSearchPath when trying to restore a search
path that specifies useTemp, but there is no active temp schema in thecurrent session. (This can happen if the path was saved during a transactionthat created a temp schema and was later rolled back.) For existing callersit's sufficient to ignore the useTemp flag in this case, though we mightlater want to offer an option to create a fresh temp schema. So far as I cantell this is just an Assert failure: in a non-assert build, the code wouldpush a zero onto the new search path, which is useless but not very harmful.Per bug report from Heikki.Back-patch to 8.3; prior versions don't have this code.
1 parent95ef7cd commit2a7349f

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

‎src/backend/catalog/namespace.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Portions Copyright (c) 1994, Regents of the University of California
1414
*
1515
* 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 $
1717
*
1818
*-------------------------------------------------------------------------
1919
*/
@@ -2667,6 +2667,17 @@ GetOverrideSearchPath(MemoryContext context)
26672667
*
26682668
* We allow nested overrides, hence the push/pop terminology. The GUC
26692669
* 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.
26702681
*/
26712682
void
26722683
PushOverrideSearchPath(OverrideSearchPath*newpath)
@@ -2700,11 +2711,8 @@ PushOverrideSearchPath(OverrideSearchPath *newpath)
27002711
if (newpath->addCatalog)
27012712
oidlist=lcons_oid(PG_CATALOG_NAMESPACE,oidlist);
27022713

2703-
if (newpath->addTemp)
2704-
{
2705-
Assert(OidIsValid(myTempNamespace));
2714+
if (newpath->addTemp&&OidIsValid(myTempNamespace))
27062715
oidlist=lcons_oid(myTempNamespace,oidlist);
2707-
}
27082716

27092717
/*
27102718
* Build the new stack entry, then insert it at the head of the list.

‎src/backend/utils/cache/plancache.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
* Portions Copyright (c) 1994, Regents of the University of California
3636
*
3737
* IDENTIFICATION
38-
* $PostgreSQL: pgsql/src/backend/utils/cache/plancache.c,v 1.35 2010/02/26 02:01:11momjian Exp $
38+
* $PostgreSQL: pgsql/src/backend/utils/cache/plancache.c,v 1.36 2010/08/13 16:27:11tgl Exp $
3939
*
4040
*-------------------------------------------------------------------------
4141
*/
@@ -513,6 +513,8 @@ RevalidateCachedPlan(CachedPlanSource *plansource, bool useResOwner)
513513

514514
/*
515515
* Restore the search_path that was in use when the plan was made.
516+
* See comments for PushOverrideSearchPath about limitations of this.
517+
*
516518
* (XXX is there anything else we really need to restore?)
517519
*/
518520
PushOverrideSearchPath(plansource->search_path);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp