The following bug has been logged on the website:
Bug reference: 16441
Logged by: Colin Darie
Email address: colin(at)darie(dot)eu
PostgreSQL version: 12.3
Operating system: macos
Description:
Multiple inserts of DEFAULT value for generated columns are failing. Single
inserts are OK.
CREATE TABLE squares (num INTEGER NOT NULL, square INTEGER GENERATED ALWAYS
AS (num * num) STORED);
INSERT INTO squares(num, square) VALUES (1, DEFAULT);
=> INSERT 0 1
INSERT INTO squares(num, square) VALUES (2, DEFAULT), (3, DEFAULT);
=> ERROR: cannot insert into column "square"
=> DETAIL: Column "square" is a generated column.
Tested with postgresql 12.2 and 12.3 on macos.