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/