Re: [Re: PRIMARY KEY] - Mailing list pgsql-sql

From Bruno Wolff III
Subject Re: [Re: PRIMARY KEY]
Date
Msg-id 20070309150332.GC23704@wolff.to
Whole thread Raw
In response to [Re: PRIMARY KEY]  (Phillip Smith <fukawi2@iinet.net.au>)
Responses Re: [Re: PRIMARY KEY]
List pgsql-sql
On Wed, Mar 07, 2007 at 23:20:12 +1100, Phillip Smith <fukawi2@iinet.net.au> wrote:
> If you actually need to know the value of N_GEN in your ASP application,
> you will need to query the database first and select the NEXTVAL from
> the sequence that the "serial" data type will create, then use that
> returned value in your insert - ie, DON'T exclude it from the insert,
> otherwise it will default to NEXTVAL again and return a different value.

In 8.2, you can also use the RETURNING clause to get those values.


pgsql-sql by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: View Vs. Table
Next
From: Richard Huxton
Date:
Subject: Re: index not being used. Why?