Re: BUG #6683: dropping a table with a serial column from an extension needs to explicitely drop the associated seq

From: Craig Ringer <ringerc(at)ringerc(dot)id(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: phb(dot)emaj(at)free(dot)fr, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6683: dropping a table with a serial column from an extension needs to explicitely drop the associated seq
Date: 2012-06-10 03:45:36
Message-ID: 4FD41860.5030200@ringerc.id.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 06/10/2012 06:14 AM, Tom Lane wrote:
> phb(dot)emaj(at)free(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message wbrana 2012-06-10 09:05:37 BUG #6684: An I/O error occured while sending to the backend
Previous Message Jaime Casanova 2012-06-09 22:21:14 Re: [BUGS] BUG #6680: error para ingresar