pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig Ringer <ringerc@ringerc.id.au>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: phb.emaj@free.fr
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
Date: Sun, 10 Jun 2012 11:45:36 +0800
Message-ID: <4FD41860.5030200@ringerc.id.au> (raw)
In-Reply-To: <5280.1339280042@sss.pgh.pa.us>
References: <E1SdFkp-0006cC-Bn@wrigleys.postgresql.org>
	<5280.1339280042@sss.pgh.pa.us>

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.

regress=# create table test (x serial primary key);
NOTICE:  CREATE TABLE will create implicit sequence "test_x_seq" for 
serial column "test.x"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index 
"test_pkey" for table "test"
CREATE TABLE
regress=# \d
            List of relations
  Schema |    Name    |   Type   | Owner
--------+------------+----------+-------
  public | test       | table    | craig
  public | test_x_seq | sequence | craig
(2 rows)

regress=# drop table test;
DROP TABLE
regress=# \d
No relations found.




regress=# create table test (x serial primary key);
NOTICE:  CREATE TABLE will create implicit sequence "test_x_seq" for 
serial column "test.x"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index 
"test_pkey" for table "test"
CREATE TABLE
regress=# alter table test drop column x;
ALTER TABLE
regress=# \d
        List of relations
  Schema | Name | Type  | Owner
--------+------+-------+-------
  public | test | table | craig
(1 row)





--
Craig Ringer



view thread (5+ messages)  latest in thread

Message-ID: <4FD41860.5030200@ringerc.id.au>
Permalink:  ../4FD41860.5030200@ringerc.id.au/
Also on:    postgresql.org/message-id/4FD41860.5030200@ringerc.id.au

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: ringerc@ringerc.id.au, tgl@sss.pgh.pa.us, phb.emaj@free.fr
  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: <E1SdFkp-0006cC-Bn@wrigleys.postgresql.org> <5280.1339280042@sss.pgh.pa.us> <4FD41860.5030200@ringerc.id.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox