Re: CREATE TABLE initial value for PRIMARY KEY - Mailing list pgsql-general

From Richard Broersma Jr
Subject Re: CREATE TABLE initial value for PRIMARY KEY
Date
Msg-id 13265.79301.qm@web31810.mail.mud.yahoo.com
Whole thread Raw
In response to CREATE TABLE initial value for PRIMARY KEY  (Maurice Yarrow <yarrow@best.com>)
Responses Re: CREATE TABLE initial value for PRIMARY KEY  (Maurice Yarrow <yarrow@best.com>)
List pgsql-general
> I thought about  using a DEFAULT value, but I had presumed
> that this was only for repeated intializations.  So then is it the
> case that a
> CREATE TABLE mytable ( id INTEGER PRIMARY KEY DEFAULT 100000, ...
> only applies this default to the very first row of such a table, and then
> sensibly, increments from there ?
> (Guess I could easily try this out...)

Ah, I think I know what you are looking for. You want an auto-incrementing number. There are
special sudo-data-types called serial bigserial.  These are really auto-incrementing
integers/bigintegers. For more details on how to use this see:

http://www.postgresql.org/docs/8.1/interactive/datatype.html#DATATYPE-SERIAL

Also, when relying, don't forget to reply also to the list that way everyone can participate.

Regards,

Richard Broersma Jr.



pgsql-general by date:

Previous
From: "Greg Quinn"
Date:
Subject: Re: Problems running PostGreSQL silent install
Next
From: "Magnus Hagander"
Date:
Subject: Re: Problems running PostGreSQL silent install