Re: BUG #6704: ALTER EXTENSION postgis SET SCHEMA leaves dangling relations

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: jeff <jeff(at)pgexperts(dot)com>, Pg Bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #6704: ALTER EXTENSION postgis SET SCHEMA leaves dangling relations
Date: 2012-08-31 19:14:05
Message-ID: 1346439762-sup-9541@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Excerpts from Alvaro Herrera's message of vie ago 31 12:26:50 -0400 2012:
> Excerpts from Tom Lane's message of vie ago 31 12:17:59 -0400 2012:
> > Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
> > > Aha, I see the bug. It seems the split for AlterObjectNamespace_oid
> > > related to tables was done at the wrong level: there should be a new
> > > AlterTableNamespace_internal call that does all the extra stuff, and
> > > which is to be called from AlterObjectNamespace_oid.
> >
> > Sounds reasonable to me. Are you going to fix it, or should I? If
> > it was introduced in the extensions patch then it's my fault ...
>
> I'm looking into it.

Here's a patch. Note I'm not attempting to create a regression test
because that seems to involve setting up a fake extension which I don't
know how to do (would be too messy, I think). So I tested it by having
isn--1.0.sql create a table with a primary key: create the extension,
alter it to move to a new schema, drop the original schema (public). If
I then try to dump the database, pg_dump in current HEAD fails with "no
schema with OID 2200" (not verbatim; OID is for the old public schema).
It seems to me that this is exactly what was reported initially. Also I
verified that psql's \d reports the inconsistency of the table and its
PK.

Patched code works fine.

For some reason, AlterSeqNamespaces was being passed a schema name.
This wasn't used and was not possible to keep in the patched code so I
just removed it.

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
alter-extension-schema.patch application/octet-stream 5.3 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2012-08-31 19:20:13 Re: BUG #6758: ./configure script sets HAVE_WCSTOMBS_L 1
Previous Message Alvaro Herrera 2012-08-31 16:26:50 Re: BUG #6704: ALTER EXTENSION postgis SET SCHEMA leaves dangling relations