Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id EDF15B37936 for ; Sun, 10 Jun 2012 09:57:31 -0300 (ADT) Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Sdhhv-0002nX-4T for pgsql-bugs@postgresql.org; Sun, 10 Jun 2012 12:57:31 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id q5ACvCia014872; Sun, 10 Jun 2012 08:57:12 -0400 (EDT) From: Tom Lane To: Craig Ringer cc: phb.emaj@free.fr, pgsql-bugs@postgresql.org Subject: Re: BUG #6683: dropping a table with a serial column from an extension needs to explicitely drop the associated seq In-reply-to: <4FD41860.5030200@ringerc.id.au> References: <5280.1339280042@sss.pgh.pa.us> <4FD41860.5030200@ringerc.id.au> Comments: In-reply-to Craig Ringer message dated "Sun, 10 Jun 2012 11:45:36 +0800" Date: Sun, 10 Jun 2012 08:57:12 -0400 Message-ID: <14871.1339333032@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201206/88 X-Sequence-Number: 33315 Craig Ringer writes: > On 06/10/2012 06:14 AM, Tom Lane wrote: >> phb.emaj@free.fr writes: >>> When a table having a seial column has been created by a CREATE EXTENSION, >>> and when this table is later dropped from the extension, the associated >>> sequence must be also explicitely dropped from the extension. >> This doesn't really seem like a bug to me. The sequence is a somewhat >> independent object. > I disagree; it is inconsistent with the expectation established in > normal operations that the sequence created to serve a SERIAL column is > owned by that table/column and is dropped when it is. But we're not talking about a DROP; we're talking about disassociating it from an extension. That's a sufficiently unusual thing to do that I think it dangerous to make any assumptions about why the extension author is doing that, or whether he wants the sequence to come too. In the reverse direction, ALTER EXTENSION ADD TABLE doesn't auto-add associated sequences either. If we did do something like this, pg_dump would need some complicated and fragile logic additions to understand the implications; for instance, if it saw an owned sequence that wasn't a member of the extension, it would have to know to issue an ALTER EXTENSION DROP SEQUENCE after adding the table. (Now admittedly, I'm on record as wanting to get rid of pg_dump having to do anything with extension members, but still it's a great example of why "helpful" automatic actions aren't necessarily a good thing.) regards, tom lane