On Jun 21, 2005, at 7:01 PM, Kenneth Gonsalves wrote:

in a table with a serial datatype, how do i get the sequence to start
at a specific number like 100000?

The SERIAL datatype (e.g., CREATE TABLE foo(foo_id SERIAL) )is a shorthand for something like
CREATE SEQUENCE foo_id_seq;
CREATE TABLE foo (foo_id integer default nextval('foo_id_seq') );

If you want it to specify the start value, you'll need to either use CREATE SEQUENCE first and then create the table with the appropriate default, or use ALTER SEQUENCE after creating the table.

http://www.postgresql.org/docs/8.0/interactive/sql-createsequence.html
http://www.postgresql.org/docs/8.0/interactive/sql-altersequence.html

Michael Glaesemann
grzm myrealbox com

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
      choose an index scan if your joining column's datatypes do not
      match

Reply via email to