From: | Einar Karttunen <ekarttun(at)cs(dot)Helsinki(dot)FI> |
---|---|
To: | Terry Fielder <terry(at)greatgulfhomes(dot)com> |
Cc: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Autonumber |
Date: | 2001-05-07 14:52:29 |
Message-ID: | Pine.LNX.4.30.0105071748540.3491-100000@sorkka.cs.Helsinki.FI |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, 3 May 2001, Terry Fielder wrote:
> Is there an autonumber data type in postgreSQL?
>
If you mean a type that it is automatically incremented then yes SERIAL.
Actually serial isn't a datatype. It is an integer column with
a default value that is the next number of a sequence that is
automatically created.
CREATE TABLE foo (
bar1 SERIAL,
bar2 text
);
INSERT INTO foo (bar2) VALUES ('text value');
INSERT INTO foo (bar2) VALUES ('text value2');
and the bar1 gets an automatic value.
- Einar Karttunen
From | Date | Subject | |
---|---|---|---|
Next Message | Vince Vielhaber | 2001-05-07 14:56:20 | Re: v7.1.1 Branched, Packaged and Released ... |
Previous Message | Tom Lane | 2001-05-07 14:44:25 | Re: Permissions and views. |