Re: OID Usage

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: OID Usage
Дата
Msg-id 20050114174154.GA13476@winnie.fuhr.org
обсуждение исходный текст
Ответ на Re: OID Usage  (Bo Lorentsen <bl@netgroup.dk>)
Ответы Re: OID Usage
Список 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 по дате отправления:

Предыдущее
От: "Frank D. Engel, Jr."
Дата:
Сообщение: Re: [HACKERS] Much Ado About COUNT(*)
Следующее
От: John Sidney-Woollett
Дата:
Сообщение: Re: C locale + unicode