Skip site navigation (1) Skip section navigation (2)

bug with alter table add column

From: Jerome Alet <alet(at)unice(dot)fr>
To: pgsql-bugs(at)postgresql(dot)org
Subject: bug with alter table add column
Date: 2000-07-19 09:40:32
Message-ID: Pine.LNX.3.96.1000719111851.279A-100000@cortex.unice.fr (view raw or flat)
Thread:
Lists: 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(at)unice(dot)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

Next:From: Bernie HuangDate: 2000-07-20 19:13:52
Subject: Damn bug!
Previous:From: Tom LaneDate: 2000-07-14 16:16:51
Subject: Re: Backend bug applying insert rules?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group