pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Don't throw serialization errors for self-conflicts in INSERT ON 3+ messages / 1 participants [nested] [flat]
* pgsql: Don't throw serialization errors for self-conflicts in INSERT ON @ 2016-10-23 22:36 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 3+ messages in thread From: Tom Lane @ 2016-10-23 22:36 UTC (permalink / raw) To: pgsql-committers Don't throw serialization errors for self-conflicts in INSERT ON CONFLICT. A transaction that conflicts against itself, for example INSERT INTO t(pk) VALUES (1),(1) ON CONFLICT DO NOTHING; should behave the same regardless of isolation level. It certainly shouldn't throw a serialization error, as retrying will not help. We got this wrong due to the ON CONFLICT logic not considering the case, as reported by Jason Dusek. Core of this patch is by Peter Geoghegan (based on an earlier patch by Thomas Munro), though I didn't take his proposed code refactoring for fear that it might have unexpected side-effects. Test cases by Thomas Munro and myself. Report: <CAO3NbwOycQjt2Oqy2VW-eLTq2M5uGMyHnGm=RNga4mjqcYD7gQ@mail.gmail.com> Related-Discussion: <57EE93C8.8080504@postgrespro.ru> Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/a6c0a5b6e8a9498540c6a7bb1b6d68958acc9bc6 Modified Files -------------- src/backend/executor/nodeModifyTable.c | 13 ++- .../expected/insert-conflict-do-nothing-2.out | 105 +++++++++++++++++++++ src/test/isolation/isolation_schedule | 1 + .../specs/insert-conflict-do-nothing-2.spec | 34 +++++++ src/test/regress/expected/insert_conflict.out | 35 +++++++ src/test/regress/sql/insert_conflict.sql | 32 +++++++ 6 files changed, 218 insertions(+), 2 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Don't throw serialization errors for self-conflicts in INSERT ON @ 2016-10-23 22:36 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 3+ messages in thread From: Tom Lane @ 2016-10-23 22:36 UTC (permalink / raw) To: pgsql-committers Don't throw serialization errors for self-conflicts in INSERT ON CONFLICT. A transaction that conflicts against itself, for example INSERT INTO t(pk) VALUES (1),(1) ON CONFLICT DO NOTHING; should behave the same regardless of isolation level. It certainly shouldn't throw a serialization error, as retrying will not help. We got this wrong due to the ON CONFLICT logic not considering the case, as reported by Jason Dusek. Core of this patch is by Peter Geoghegan (based on an earlier patch by Thomas Munro), though I didn't take his proposed code refactoring for fear that it might have unexpected side-effects. Test cases by Thomas Munro and myself. Report: <CAO3NbwOycQjt2Oqy2VW-eLTq2M5uGMyHnGm=RNga4mjqcYD7gQ@mail.gmail.com> Related-Discussion: <57EE93C8.8080504@postgrespro.ru> Branch ------ REL9_6_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/c4016fcb1fd2a20ef589a3a616b59381256a985a Modified Files -------------- src/backend/executor/nodeModifyTable.c | 13 ++- .../expected/insert-conflict-do-nothing-2.out | 105 +++++++++++++++++++++ src/test/isolation/isolation_schedule | 1 + .../specs/insert-conflict-do-nothing-2.spec | 34 +++++++ src/test/regress/expected/insert_conflict.out | 35 +++++++ src/test/regress/sql/insert_conflict.sql | 32 +++++++ 6 files changed, 218 insertions(+), 2 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Don't throw serialization errors for self-conflicts in INSERT ON @ 2016-10-23 22:36 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 3+ messages in thread From: Tom Lane @ 2016-10-23 22:36 UTC (permalink / raw) To: pgsql-committers Don't throw serialization errors for self-conflicts in INSERT ON CONFLICT. A transaction that conflicts against itself, for example INSERT INTO t(pk) VALUES (1),(1) ON CONFLICT DO NOTHING; should behave the same regardless of isolation level. It certainly shouldn't throw a serialization error, as retrying will not help. We got this wrong due to the ON CONFLICT logic not considering the case, as reported by Jason Dusek. Core of this patch is by Peter Geoghegan (based on an earlier patch by Thomas Munro), though I didn't take his proposed code refactoring for fear that it might have unexpected side-effects. Test cases by Thomas Munro and myself. Report: <CAO3NbwOycQjt2Oqy2VW-eLTq2M5uGMyHnGm=RNga4mjqcYD7gQ@mail.gmail.com> Related-Discussion: <57EE93C8.8080504@postgrespro.ru> Branch ------ REL9_5_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/65d85b8f9dc3768b3b5bf59187620e9c7cafcb47 Modified Files -------------- src/backend/executor/nodeModifyTable.c | 13 ++- .../expected/insert-conflict-do-nothing-2.out | 105 +++++++++++++++++++++ src/test/isolation/isolation_schedule | 1 + .../specs/insert-conflict-do-nothing-2.spec | 34 +++++++ src/test/regress/expected/insert_conflict.out | 35 +++++++ src/test/regress/sql/insert_conflict.sql | 32 +++++++ 6 files changed, 218 insertions(+), 2 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2016-10-23 22:36 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2016-10-23 22:36 pgsql: Don't throw serialization errors for self-conflicts in INSERT ON Tom Lane <tgl@sss.pgh.pa.us> 2016-10-23 22:36 pgsql: Don't throw serialization errors for self-conflicts in INSERT ON Tom Lane <tgl@sss.pgh.pa.us> 2016-10-23 22:36 pgsql: Don't throw serialization errors for self-conflicts in INSERT ON Tom Lane <tgl@sss.pgh.pa.us>
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