Re: serial autoincrement and related table - Mailing list pgsql-general

From Milos Prudek
Subject Re: serial autoincrement and related table
Date
Msg-id 40A8A797.4000708@bvx.cz
Whole thread Raw
In response to Re: serial autoincrement and related table  (Paul Thomas <paul@tmsl.demon.co.uk>)
List pgsql-general
 > If you want PostgreSQL to populate your idmember field with the next
 > value from the sequence, you need to specify the keyword DEFAULT as its
 > value or omit it from the INSERT list of coulumns (this assumes you have

I do omit it.

 > DEFAULT nextval('members_idmember_seq') defined on the idmember column).

I use CREATE TABLE "members" (idmember" SERIAL PRIMARY KEY, ...);

 > Should be :
 >
 > Cmd = "SELECT currval('members_idmember_seq');"

Ah, thanks for the shorter syntax.

 > Remember that there's no such thing as auto-increment fields in
 > PostgreSQL - they are SEQUENCES.

I know.

So, it's the best or reasonable practice(TM), isn't it?

--
Milos Prudek


pgsql-general by date:

Previous
From: Paul Thomas
Date:
Subject: Re: serial autoincrement and related table
Next
From: Richard Huxton
Date:
Subject: Re: serial autoincrement and related table