Getting last insert value - Mailing list pgsql-sql

From Yasir Malik
Subject Getting last insert value
Date
Msg-id Pine.SGI.4.58.0311151003320.76056@guinness.cs.stevens-tech.edu
Whole thread Raw
Responses Re: Getting last insert value  (Guillaume LELARGE <gleu@wanadoo.fr>)
Re: Getting last insert value  (Theodore Petrosky <tedpet5@yahoo.com>)
List pgsql-sql
Hello,
I have a table with many fields, and one of the fields is of type serial.
I will do many inserts, and there will be many repeats of the other fields
in the table, but, obviously, the serial field will be unique for all the
rows.  How can I get the value of serial field of the last row I inserted.
I know I can select the maximum value from the serial field, but is there
a better way, preferably something that takes constant time.
Thanks,
Yasir Malik


pgsql-sql by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Programatically switching database
Next
From: Guillaume LELARGE
Date:
Subject: Re: Getting last insert value