Re: Using oid as pkey

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: "D(dot) Dante Lorenso" <dante(at)lorenso(dot)com>
Cc: Michael Glaesemann <grzm(at)seespotcode(dot)net>, "Ed L(dot)" <pgsql(at)bluepolka(dot)net>, Postgres-General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Using oid as pkey
Date: 2007-08-20 23:10:59
Message-ID: 20070820231059.GF27916@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

D. Dante Lorenso wrote:

> I want the value of col0 returned to the application and I don't want to
> know the name of the sequence involved in the SERIAL column. I just want
> the value inserted into the column by using just it's column name.

Use pg_get_serial_sequence(). Don't use lastval() if you can help it,
because it's a foot gun.

--
Alvaro Herrera http://www.amazon.com/gp/registry/DXLWNGRJD34J
"I love the Postgres community. It's all about doing things _properly_. :-)"
(David Garamond)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rainer Bauer 2007-08-20 23:14:23 Re: Using oid as pkey
Previous Message Michael Glaesemann 2007-08-20 23:09:49 Re: Using oid as pkey