Re: currval() in insert statements

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Re: currval() in insert statements
Дата
Msg-id 49982164.6060506@postnewspapers.com.au
обсуждение исходный текст
Ответ на currval() in insert statements  (Onno Molenkamp <onno@flox.org>)
Список pgsql-general
Onno Molenkamp wrote:
> Hi,
>
> I recently upgraded a database from 8.1.11 to 8.3.6, and I noticed the
> following statement stopped working:
>
>   insert into test (b) select currval('test_a_seq'::regclass)

It's generally a REALLY bad idea to mix `nextval' and `currval' use on
the same sequence in a single SQL statement.

Personally, in the one case in the project I'm working on where I DO
need to INSERT a generated ID in two places I use a trigger to take care
of it.

--
Craig Ringer

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

Предыдущее
От: Bjørn T Johansen
Дата:
Сообщение: How do I set the schema search path in a datasource config for a connection pool?
Следующее
От: Osvaldo Kussama
Дата:
Сообщение: Re: Array in nested query