SERIALIZABLE and INSERTs with multiple VALUES

From: Jason Dusek <jason(dot)dusek(at)gmail(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: SERIALIZABLE and INSERTs with multiple VALUES
Date: 2016-10-11 19:29:28
Message-ID: CAO3NbwOycQjt2Oqy2VW-eLTq2M5uGMyHnGm=RNga4mjqcYD7gQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi All,

I notice the following oddity:

=# CREATE TABLE with_pk (i integer PRIMARY KEY);CREATE TABLE

=# BEGIN;BEGIN
=# INSERT INTO with_pk VALUES (1) ON CONFLICT DO NOTHING;INSERT 0 1
=# INSERT INTO with_pk VALUES (1) ON CONFLICT DO NOTHING;INSERT 0 0
=# END;COMMIT

=# BEGIN;BEGIN
=# INSERT INTO with_pk VALUES (2), (2) ON CONFLICT DO NOTHING;
ERROR: could not serialize access due to concurrent update
=# END;ROLLBACK

How are these two transactions different?

Kind Regards,

Jason Dusek

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Melvin Davidson 2016-10-11 19:50:29 Re: My DB has has 5TB, many operations are very slow (on Google Cloud Compute)
Previous Message Francisco Olarte 2016-10-11 19:16:29 Re: My DB has has 5TB, many operations are very slow (on Google Cloud Compute)