Yes, and it’s good if you think about it.
You can trivially demonstrate this with three simultaneous psql sessions, given some table
CREATE TABLE x (
seq serial primary key,
n integer not null
);
then
SESSION 1 SESSION 2 SESSION 3
BEGIN;
BEGIN;
INSERT INTO x(n) VALUES(1)
INSERT INTO x(n) VALUES (2);
COMMIT;
SELECT * FROM x;
COMMIT;
SELECT * FROM x;
It is unsafe to assume that for any generated value, nall generated values were n-1used by already processed or already canceled xacts. They can be performed and performed after you see n.
, . SERIALIZABLE .
, , .