pgsql: Fix multiple bugs in extension dropping.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix multiple bugs in extension dropping.
Date: 2011-08-24 17:09:34
Message-ID: E1QwGxK-0002Kb-8n@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix multiple bugs in extension dropping.

When we implemented extensions, we made findDependentObjects() treat
EXTENSION dependency links similarly to INTERNAL links. However, that
logic contained an implicit assumption that an object could have at most
one INTERNAL dependency, so it did not work correctly for objects having
both INTERNAL and DEPENDENCY links. This led to failure to drop some
extension member objects when dropping the extension. Furthermore, we'd
never actually exercised the case of recursing to an internally-referenced
(owning) object from anything other than a NORMAL dependency, and it turns
out that passing the incoming dependency's flags to the owning object is
the Wrong Thing. This led to sometimes dropping a whole extension silently
when we should have rejected the drop command for lack of CASCADE.

Since we obviously were under-testing extension drop scenarios, add some
regression test cases. Unfortunately, such test cases require some
extensions (duh), so we can't test for problems in the core regression
tests. I chose to add them to the earthdistance contrib module, which is
a good test case because it has a dependency on the cube contrib module.

Back-patch to 9.1. Arguably these are pre-existing bugs in INTERNAL
dependency handling, but since it appears that the cases can never arise
pre-9.1, I'll refrain from back-patching the logic changes further than
that.

Branch
------
REL9_1_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/e8513328760ea175001bac52c10219315379b2c1

Modified Files
--------------
contrib/earthdistance/expected/earthdistance.out | 332 +++++++++++++++++++++-
contrib/earthdistance/sql/earthdistance.sql | 74 +++++-
src/backend/catalog/dependency.c | 119 +++++---
3 files changed, 477 insertions(+), 48 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2011-08-24 17:47:22 pgsql: Avoid locale dependency in expected output.
Previous Message Tom Lane 2011-08-24 01:49:46 pgsql: Make CREATE EXTENSION check schema creation permissions.