Clemens Eisserer <linuxhi...@gmail.com> writes:
> Is it possible to use an implicit sequence with a start value?
> Something like:  CREATE TABLE foo (key SERIAL START 1000 PRIMARY KEY NOT 
> NULL);

Well, you can't do it just that way, but you could issue a setval() or
ALTER SEQUENCE command after creating the table.  For instance

regression=# create table foo (bar serial);
NOTICE:  CREATE TABLE will create implicit sequence "foo_bar_seq" for serial 
column "foo.bar"
CREATE TABLE
regression=# alter sequence foo_bar_seq start with 1000;
ALTER SEQUENCE

or you might prefer

regression=# select setval(pg_get_serial_sequence('foo', 'bar'), 1000);
 setval 
--------
   1000
(1 row)


                        regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to