Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 2A79BB37936 for ; Sun, 10 Jun 2012 07:31:40 -0300 (ADT) Received: from smtp6-g21.free.fr ([2a01:e0c:1:1599::15]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SdfQn-00088N-Kk for pgsql-bugs@postgresql.org; Sun, 10 Jun 2012 10:31:39 +0000 Received: from [192.168.1.2] (unknown [82.233.212.24]) by smtp6-g21.free.fr (Postfix) with ESMTP id 061DE82252; Sun, 10 Jun 2012 12:31:20 +0200 (CEST) Message-ID: <4FD47776.7050909@free.fr> Date: Sun, 10 Jun 2012 12:31:18 +0200 From: Philippe BEAUDOIN User-Agent: Thunderbird 2.0.0.24 (X11/20101027) MIME-Version: 1.0 To: Craig Ringer CC: 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 References: <5280.1339280042@sss.pgh.pa.us> <4FD41860.5030200@ringerc.id.au> In-Reply-To: <4FD41860.5030200@ringerc.id.au> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201206/91 X-Sequence-Number: 33318 Craig Ringer a =E9crit : > 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=20 >>> EXTENSION, >>> and when this table is later dropped from the extension, the associat= ed >>> 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=20 > normal operations that the sequence created to serve a SERIAL column=20 > is owned by that table/column and is dropped when it is. > > regress=3D# create table test (x serial primary key); > NOTICE: CREATE TABLE will create implicit sequence "test_x_seq" for=20 > serial column "test.x" > NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index=20 > "test_pkey" for table "test" > CREATE TABLE > regress=3D# \d > List of relations > Schema | Name | Type | Owner > --------+------------+----------+------- > public | test | table | craig > public | test_x_seq | sequence | craig > (2 rows) > > regress=3D# drop table test; > DROP TABLE > regress=3D# \d > No relations found. > > > > > regress=3D# create table test (x serial primary key); > NOTICE: CREATE TABLE will create implicit sequence "test_x_seq" for=20 > serial column "test.x" > NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index=20 > "test_pkey" for table "test" > CREATE TABLE > regress=3D# alter table test drop column x; > ALTER TABLE > regress=3D# \d > List of relations > Schema | Name | Type | Owner > --------+------+-------+------- > public | test | table | craig > (1 row) > > > > > > --=20 > Craig Ringer > > I aggree with Craig. The current rule is not natural (at least for me, as I did the mistake=20 in one of my extension scripts ;-)) If this behaviour remains as is, it should be at least documented. Finding the best desirable behaviour is probably also linked with the=20 discussion just started for BUG #6682. Best regards. Philippe BEAUDOIN.