Re: [BUGS] BUG #14774: INSERT ... ON CONFLICT

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: [BUGS] BUG #14774: INSERT ... ON CONFLICT
Дата
Msg-id 20170808180623.imtdrllz6uhn3gqg@alap3.anarazel.de
обсуждение исходный текст
Ответ на [BUGS] BUG #14774: INSERT ... ON CONFLICT  (jym@outlook.com)
Список pgsql-bugs
Hi,

On 2017-08-08 17:15:00 +0000, jym@outlook.com wrote:
> I've noticed that if there's a conflict the sequence still adds 1 even if
> the INSERT is a conflict.
> 
> i.e. INSERT INTO foo(bar) VALUES ('test') ON CONFLICT bar = EXCLUDE.bar
> returning foopk
> 
> bar has a UNIQUE constraint, doing this 10 times you see the Next serial in
> foopk is 10 even though there is only 1 row in the table.

That's behaving as expected. The full row, including the column that
defaults to the sequence, needs to be formed before checking for
conflicts.  Sequences are not gapless, and this is just one of many
examples.  Is there a specific reason this is a problem for you?

Greetings,

Andres Freund


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

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

Предыдущее
От: jym@outlook.com
Дата:
Сообщение: [BUGS] BUG #14774: INSERT ... ON CONFLICT
Следующее
От: Rick Otten
Дата:
Сообщение: Re: [BUGS] signal 11 segfaults with parallel workers