Re: postgresql experts please help

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: postgresql experts please help
Дата
Msg-id Pine.BSO.4.64.0710181817030.15177@leary.csoft.net
обсуждение исходный текст
Ответ на Re: postgresql experts please help  (Michael Schmidt <MichaelMSchmidt@msn.com>)
Список pgsql-jdbc

On Thu, 18 Oct 2007, Michael Schmidt wrote:

> There is:
>
> SELECT currval(pg_get_serial_sequence('mytab','mycol'));
>
>
> Tried this as an isolated statement and it returned null, so it appears to
> also require that nextval be run before it can work.
>

No one was ever saying otherwise.  All this discussion is focused around
the example that Andrei provided where an insert was done on a table with
a serial column.

In your case you're getting NULL because pg_get_serial_sequence returns
NULL for a column that doesn't have a sequence attached to it and currval
is STRICT.  If you try this on something that is actually a serial column
you will get the expected error instead of NULL.

Kris Jurka

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Michael Schmidt
Дата:
Сообщение: Re: postgresql experts please help
Следующее
От: "Andrei Ilitchev"
Дата:
Сообщение: Re: Fw: postgresql experts please help