Re: INSERT locking order

2020-01-09 Thread Tom Lane
Matthew Woodcraft writes: > In an INSERT, are the rows guaranteed to be inserted in the order that > the source query returns its rows, for locking purposes? I dunno that we "guarantee" that, but it's hard to see why the code would behave any differently, at present. > and I run two concurrent c

INSERT locking order

2020-01-09 Thread Matthew Woodcraft
In an INSERT, are the rows guaranteed to be inserted in the order that the source query returns its rows, for locking purposes? For example, if have CREATE TABLE foo ( foo_id INTEGER, PRIMARY KEY (foo_id) ); and I run two concurrent copies of INSERT INTO foo (SELECT n FROM ... ORDER B