Hi,

> > My question:
> > is there anyway of retreiving the sequence_name corresponding to the
> > respective column,
> > knowing just the tablename and columnname?
> >
> > The reason I need to do this, is because the application I write
> > dynamicly creates new tables, and I have no way of knowing the sequence
> > name before hand.
> >
>
>If it is very difficult finding that sequence name (I'm not sure)
>You may want to create the sequence yourself instead of using SERIAL.
>Then you would know the name.

Not hard at all.

csmith=# create table test (testid serial, name text);
NOTICE:  CREATE TABLE will create implicit sequence 'test_testid_seq' for 
SERIAL column 'test.testid'
NOTICE:  CREATE TABLE/UNIQUE will create implicit index 'test_testid_key' 
for table 'test'
CREATE

Sequence name becomes <tablename>_<columnname>_seq

so if we use the serial datatype to create a column called "xyz" in the 
table "abc" the sequence name is :

abc_xyz_seq

Make sense?


-----------------
      Chris Smith
http://www.squiz.net/

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to