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

From: Doug McNaught <doug(at)mcnaught(dot)org>
To: scott_list(at)mischko(dot)com
Cc: Andrew Sullivan <andrew(at)libertyrms(dot)info>, pgsql-general(at)postgresql(dot)org
Subject: Re: SQL-question: returning the id of an insert querry
Date: 2003-11-12 19:29:01
Message-ID: 87vfppwflu.fsf@asmodeus.mcnaught.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Scott Chapman <scott_list(at)mischko(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Paul Thomas 2003-11-12 19:44:34 Re: RHEL
Previous Message Scott Chapman 2003-11-12 19:17:26 Re: SQL-question: returning the id of an insert querry