Re: serial type vs. sequences - Mailing list pgsql-general

From Bruno Wolff III
Subject Re: serial type vs. sequences
Date
Msg-id 20031112211737.GB2077@wolff.to
Whole thread Raw
In response to serial type vs. sequences  (Suchandra Thapa <s-thapa-11@alumni.uchicago.edu>)
List pgsql-general
On Wed, Nov 12, 2003 at 14:59:33 -0600,
  Suchandra Thapa <s-thapa-11@alumni.uchicago.edu> wrote:
> I was wondering if there was a reliable method to get the last id
> inserted into a serial column in a table.  I believe previous
> recommendations given were to use a sequence, have your app get the
> nextval for the sequence and then use that in the insert.  I was
> wondering if things had changed or if that is still the recommended
> method.

It is probably a little better to use currval rather than remembering
what nextval returned in your application.

pgsql-general by date:

Previous
From: Suchandra Thapa
Date:
Subject: serial type vs. sequences
Next
From: Christopher Murtagh
Date:
Subject: Re: pl/perl function life and variable scope -