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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
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 21:50:41
Message-ID: 22747.1346449841@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
> Excerpts from Alvaro Herrera's message of vie ago 31 16:25:40 -0400 2012:
>> This doesn't actually work though: it's trying to move sequences twice.
>> Not sure what the right fix for this is ... still looking.

> Besides being listed with deptype=extension for the extension in
> question, the sequence has a deptype=auto entry for the column, which
> leads to it being moved twice.

Ah so.

> 2. During ALTER EXTENSION execution, skip moving objects that have
> already been moved. Not really sure how this would be implemented;

+1 for this approach. I'm a bit surprised we didn't hit this before,
because in general there can be multiple dependency chains leading from
object A to object B. Most code that is doing more than trivial
dependency-walking has to be prepared to cope with reaching the same
object multiple times.

Implementation like this seems reasonable:

> 4. Maybe we could have AlterRelationNamespaceInternal check what the
> current namespace is for the object, and do nothing if it's already the
> target namespace.

We already have some such shortcut for ALTER OWNER, IIRC, so why not
for SET SCHEMA as well? I suspect that AlterRelationNamespaceInternal
is not the only function that needs it, too.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Devrim GÜNDÜZ 2012-09-01 00:20:39 Re: BUG #7512: can't install pgdg-centos91-9.1-4.noarch.rpm
Previous Message Alvaro Herrera 2012-08-31 21:00:52 Re: BUG #6704: ALTER EXTENSION postgis SET SCHEMA leaves dangling relations