pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #16441: Cannot multi-insert into generated column with DEFAULT value
2+ messages / 2 participants
[nested] [flat]

* BUG #16441: Cannot multi-insert into generated column with DEFAULT value
@ 2020-05-15 21:07  PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Bug reporting form @ 2020-05-15 21:07 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: colin@darie.eu

The following bug has been logged on the website:

Bug reference:      16441
Logged by:          Colin Darie
Email address:      colin@darie.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.



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #16441: Cannot multi-insert into generated column with DEFAULT value
@ 2020-05-18 14:57  Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  parent: PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Peter Eisentraut @ 2020-05-18 14:57 UTC (permalink / raw)
  To: colin@darie.eu; pgsql-bugs@lists.postgresql.org

On 2020-05-15 23:07, PG Bug reporting form wrote:
> 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.

Yes, this has been reported before.  This is basically just not 
implemented.  Is there a reason you need to use this form, or are you 
just trying things out?

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2020-05-18 14:57 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-05-15 21:07 BUG #16441: Cannot multi-insert into generated column with DEFAULT value PG Bug reporting form <noreply@postgresql.org>
2020-05-18 14:57 ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>

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