Re: SQL-question: returning the id of an insert querry

Douglas McNaught <doug@mcnaught.org>

From: Doug McNaught <doug@mcnaught.org>
To: scott_list@mischko.com
Cc: Andrew Sullivan <andrew@libertyrms.info>, pgsql-general@postgresql.org
Date: 2003-11-12T19:29:01Z
Lists: pgsql-general
Scott Chapman <scott_list@mischko.com> writes:

> It would be nice if PostgreSQL could return the primary key it inserted 
> with but that may not be a fool-proof solution either.  Is there a nice 
> way to handle this situation?

Write a database function that inserts the record and returns the
primary key value?  That's probably the best way to insulate your app
from the database structure...

-Doug