Re: nextval, sequences and sequencenames
От | Chris |
---|---|
Тема | Re: nextval, sequences and sequencenames |
Дата | |
Msg-id | 5.1.0.14.0.20010815120743.0327b010@cooee.cybersydney.com.au обсуждение исходный текст |
Ответ на | Re: nextval, sequences and sequencenames (missive@frontiernet.net (Lee Harr)) |
Ответы |
Re: Re: nextval, sequences and sequencenames
|
Список | pgsql-general |
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/
В списке pgsql-general по дате отправления: