Re: Re: Insert/Dump/Restore table with generated columns

From: zickzack(at)quantentunnel(dot)de
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Re: Insert/Dump/Restore table with generated columns
Date: 2021-07-08 14:01:25
Message-ID: trinity-6620c869-da27-4cb7-b297-c4790eb2036c-1625752885239@3c-app-gmx-bs63
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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. Due to the latter I ran into the behaviour described obove.
If I export the data with the default copy statement, no problems occur.

Greetings

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2021-07-08 14:12:04 Re: Insert/Dump/Restore table with generated columns
Previous Message Michael Lewis 2021-07-08 12:30:26 Re: optimization issue