Autonumber
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
On Thu, May 03, 2001 at 11:11:20AM -0700, Terry Fielder wrote:
Is there an autonumber data type in postgreSQL?
"SERIAL"
CREATE TABLE xxx (id SERIAL, data TEXT);
or see docs for 'create sequence' -- it's more controllable stuff.
Karel
--
Karel Zak <zakkr@zf.jcu.cz>
http://home.zf.jcu.cz/~zakkr/
C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz