pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #14774: INSERT ... ON CONFLICT
2+ messages / 2 participants
[nested] [flat]
* BUG #14774: INSERT ... ON CONFLICT
@ 2017-08-08 17:15 jym@outlook.com
2017-08-08 18:06 ` Re: BUG #14774: INSERT ... ON CONFLICT Andres Freund <andres@anarazel.de>
0 siblings, 1 reply; 2+ messages in thread
From: jym@outlook.com @ 2017-08-08 17:15 UTC (permalink / raw)
To: pgsql-bugs; +Cc: jym@outlook.com
The following bug has been logged on the website:
Bug reference: 14774
Logged by: Jym Morton
Email address: jym@outlook.com
PostgreSQL version: 9.6.3
Operating system: Windows 10
Description:
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.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #14774: INSERT ... ON CONFLICT
2017-08-08 17:15 BUG #14774: INSERT ... ON CONFLICT jym@outlook.com
@ 2017-08-08 18:06 ` Andres Freund <andres@anarazel.de>
0 siblings, 0 replies; 2+ messages in thread
From: Andres Freund @ 2017-08-08 18:06 UTC (permalink / raw)
To: jym@outlook.com; +Cc: 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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2017-08-08 18:06 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-08-08 17:15 BUG #14774: INSERT ... ON CONFLICT jym@outlook.com
2017-08-08 18:06 ` Andres Freund <andres@anarazel.de>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox