pgsql: Fix test about ignoring extension dependencies during extension

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix test about ignoring extension dependencies during extension
Date: 2016-11-26 18:32:06
Message-ID: E1cAhle-0000dE-KS@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix test about ignoring extension dependencies during extension scripts.

Commit 08dd23cec introduced an exception to the rule that extension member
objects can only be dropped as part of dropping the whole extension,
intending to allow such drops while running the extension's own creation or
update scripts. However, the exception was only applied at the outermost
recursion level, because it was modeled on a pre-existing check to ignore
dependencies on objects listed in pendingObjects. Bug #14434 from Philippe
Beaudoin shows that this is inadequate: in some cases we can reach an
extension member object by recursion from another one. (The bug concerns
the serial-sequence case; I'm not sure if there are other cases, but there
might well be.)

To fix, revert 08dd23cec's changes to findDependentObjects() and instead
apply the creating_extension exception regardless of stack level.

Having seen this example, I'm a bit suspicious that the pendingObjects
logic is also wrong and such cases should likewise be allowed at any
recursion level. However, changing that would interact in subtle ways
with the recursion logic (at least it would need to be moved to after the
recursing-from check). Given that the code's been like that a long time,
I'll refrain from touching it without a clear example showing it's wrong.

Back-patch to all active branches. In HEAD and 9.6, where suitable
test infrastructure exists, add a regression test case based on the
bug report.

Report: <20161125151448(dot)6529(dot)33039(at)wrigleys(dot)postgresql(dot)org>
Discussion: <13224(dot)1480177514(at)sss(dot)pgh(dot)pa(dot)us>

Branch
------
REL9_5_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/576bd360b2702e5418ee0c5cb11db4cc04ccec99

Modified Files
--------------
src/backend/catalog/dependency.c | 51 ++++++++++++++++++++--------------------
1 file changed, 25 insertions(+), 26 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Magnus Hagander 2016-11-27 16:12:29 pgsql: Mention server start requirement for ssl parameters
Previous Message Robert Haas 2016-11-26 15:33:44 pgsql: Mark IsPostmasterEnvironment and IsBackgroundWorker as PGDLLIMPO