bug with alter table add column - Mailing list pgsql-bugs

From Jerome Alet
Subject bug with alter table add column
Date
Msg-id Pine.LNX.3.96.1000719111851.279A-100000@cortex.unice.fr
Whole thread Raw
List pgsql-bugs
Hi,

Under Postgresql 7.0.2 (linux86), I've just noticed a strange behavior (I
suppose it's a bug) with alter table, but don't know if it's a known one
or not:

the following works great:

db=> CREATE TABLE foo (id SERIAL);
NOTICE:  CREATE TABLE will create implicit sequence 'foo_id_seq' for
SERIAL column 'foo.id'
NOTICE:  CREATE TABLE/UNIQUE will create implicit index 'foo_id_key' for
table 'foo'
CREATE

db=> \ds
       List of relations
    Name    |   Type   | Owner
------------+----------+--------
 foo_id_seq | sequence | jerome
(1 row)


but the following doesn't create the sequence bar_id_seq:

db=> CREATE TABLE bar (somefield TEXT);
CREATE
db=> ALTER TABLE bar ADD COLUMN id SERIAL;
ALTER
db=> \ds
       List of relations
    Name    |   Type   | Owner
------------+----------+--------
 foo_id_seq | sequence | jerome
(1 row)


The ALTER command should have created a sequence named bar_id_seq, as well
as an index but has done none.

I suppose it's a bug.

also it would be fine if ALTER could rename other things than just tables;

bye,

Jerome ALET - alet@unice.fr - http://cortex.unice.fr/~jerome
Faculte de Medecine de Nice - http://noe.unice.fr - Tel: 04 93 37 76 30
28 Avenue de Valombrose - 06107 NICE Cedex 2 - FRANCE

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Backend bug applying insert rules?
Next
From: Bernie Huang
Date:
Subject: Damn bug!