Re: Re: Insert/Dump/Restore table with generated columns - Mailing list pgsql-general

From zickzack@quantentunnel.de
Subject Re: Re: Insert/Dump/Restore table with generated columns
Date
Msg-id trinity-6620c869-da27-4cb7-b297-c4790eb2036c-1625752885239@3c-app-gmx-bs63
Whole thread Raw
In response to Re: Insert/Dump/Restore table with generated columns  (David Rowley <dgrowleyml@gmail.com>)
Responses Re: Insert/Dump/Restore table with generated columns
List pgsql-general
Hi David,

thanks for you're quick answer.
I'am using postgres 12 and also tested with 13. Both inside the official (debian based) docker hub hosted container.

After you're answer I did a few investigations. If I insert data with a single insert, everything is working like
expected

INSERT INTO public.ab VALUES (1, DEFAULT);

this changes if I do multiple inserts in one statement:

INSERT INTO public.ab VALUES (1, DEFAULT), (2, DEFAULT);
ERROR:  cannot insert into column "b"
DETAIL:  Column "b" is a generated column.

Is this a bug or a feature?

In my specific backup case I exported the data with the flags: --column-inserts, --inserts and --rows-per-insert=1000.
Dueto the latter I ran into the behaviour described obove.
 
If I export the data with the default copy statement, no problems occur.

Greetings



pgsql-general by date:

Previous
From: Michael Lewis
Date:
Subject: Re: optimization issue
Next
From: Tom Lane
Date:
Subject: Re: Insert/Dump/Restore table with generated columns