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

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: Scott Chapman <scott_list(at)mischko(dot)com>
Cc: Doug McNaught <doug(at)mcnaught(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: SQL-question: returning the id of an insert querry
Date: 2003-11-12 20:20:32
Message-ID: 20031112202032.GH30587@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Nov 12, 2003 at 11:46:44AM -0800, Scott Chapman wrote:
> On Wednesday 12 November 2003 11:29, Doug McNaught wrote:
> >
> > 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...
>
> The function still has to know which sequence to pull from doesn't it?

Yes, but it could pull it from the system catalogs ... (not too
portable)

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"No necesitamos banderas
No reconocemos fronteras" (Jorge González)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2003-11-12 20:25:02 Re: pl/perl function life and variable scope - concurrency problem?
Previous Message Adam Ruth 2003-11-12 20:19:24 Re: Column Sizes