"Paul Sorenson" <pauls@classware.com.au> writes:
> I have a somewhat klunky hack in an application which immediately after
> inserting a row into a table with a "serial" for the primary key I do a
> select based on values I know to be unique (at least for the table in
> question).
You can use currval() to read the assigned sequence value after the
insertion. The other common approach is to select the nextval()
explicitly and then insert it into the new row, instead of allowing
nextval() to be invoked by default. See the FAQ ...
regards, tom lane