Re: [Re: PRIMARY KEY]

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Phillip Smith <fukawi2(at)iinet(dot)net(dot)au>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: [Re: PRIMARY KEY]
Date: 2007-03-09 15:03:32
Message-ID: 20070309150332.GC23704@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, Mar 07, 2007 at 23:20:12 +1100,
Phillip Smith <fukawi2(at)iinet(dot)net(dot)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.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2007-03-09 15:59:48 Re: index not being used. Why?
Previous Message Bruno Wolff III 2007-03-09 15:01:35 Re: View Vs. Table