Thread

  1. bug with alter table add column

    Jerome Alet <alet@unice.fr> — 2000-07-19T09:40:32Z

    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