From: | Michael Fuhr <mike(at)fuhr(dot)org> |
---|---|
To: | Bo Lorentsen <bl(at)netgroup(dot)dk> |
Cc: | "pgsql-general postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: OID Usage |
Date: | 2005-01-14 17:41:54 |
Message-ID: | 20050114174154.GA13476@winnie.fuhr.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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/
From | Date | Subject | |
---|---|---|---|
Next Message | John Sidney-Woollett | 2005-01-14 18:28:04 | Re: C locale + unicode |
Previous Message | Frank D. Engel, Jr. | 2005-01-14 17:39:04 | Re: [HACKERS] Much Ado About COUNT(*) |