Re: OID Usage - Mailing list pgsql-general

From Michael Fuhr
Subject Re: OID Usage
Date
Msg-id 20050114174154.GA13476@winnie.fuhr.org
Whole thread Raw
In response to Re: OID Usage  (Bo Lorentsen <bl@netgroup.dk>)
Responses Re: OID Usage
List pgsql-general
On Fri, Jan 14, 2005 at 11:47:25AM +0100, Bo Lorentsen wrote:
> Michael Fuhr wrote:
>
> >PostgreSQL 8.0 will have a pg_get_serial_sequence() function that
> >returns the sequence name for a particular column so you don't have
> >to construct it.  This is useful when a table or column has been
> >renamed, in which case the above will probably break.
> >
> Quite nice but not what I need, as I still need to know the id column name.

You could query the system catalogs for the table's primary key,
either on the client side or in a server-side function.  The
pg_attrdef table even has the default value's nextval() expression
with the sequence name, which could be converted into a currval()
call.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

pgsql-general by date:

Previous
From: "Frank D. Engel, Jr."
Date:
Subject: Re: [HACKERS] Much Ado About COUNT(*)
Next
From: John Sidney-Woollett
Date:
Subject: Re: C locale + unicode