Thread: How to auto create a unique key for each newly added record?
Hi, How to if it is possible to let postgresql to auto assign unique key to each new record that is added to the database? Thanks
On Mon, 26 Mar 2001 21:20:13 -0500 "Jeff" <jklcom@mindspring.com> wrote: > Hi, > > How to if it is possible to let postgresql to auto assign unique key to each > new record that is added to the database? > Just set up the table with the field you are wanting to have as a unique id as type "serial". eg: create table auto_id (id serial, description varchar(32)); Cheers Zak
Make a column of type SERIAL. See http://www.postgresql.org/docs/aw_pgsql_book/node88.html ----- Original Message ----- From: "Jeff" <jklcom@mindspring.com> To: <pgsql-general@postgresql.org> Sent: Monday, March 26, 2001 6:20 PM Subject: [GENERAL] How to auto create a unique key for each newly added record? > Hi, > > How to if it is possible to let postgresql to auto assign unique key to each > new record that is added to the database? > > Thanks > > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/users-lounge/docs/faq.html