Re: pg_dump insert column GENERATED - Mailing list pgsql-general

From Дмитрий Иванов
Subject Re: pg_dump insert column GENERATED
Date
Msg-id CAPL5KHp1FApMs60TF8TTB5dye6XQ9f-SPKSJtZEiBxOWG2sASQ@mail.gmail.com
Whole thread Raw
In response to Re: pg_dump insert column GENERATED  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: pg_dump insert column GENERATED  (Дмитрий Иванов <firstdismay@gmail.com>)
List pgsql-general
Рад помочь! 
--
С уважением, Дмитрий!


пн, 22 нояб. 2021 г. в 19:55, Tom Lane <tgl@sss.pgh.pa.us>:
Дмитрий Иванов <firstdismay@gmail.com> writes:
> Uchet=# select attname, attgenerated from pg_attribute
> Uchet-# where attrelid = 'bpd.object'::regclass and attnum > 0;
>             attname            | attgenerated
> -------------------------------+--------------
>  id                            |
>  id_class                      |
>  id_position                   |
>  ........pg.dropped.4........  |
>  ........pg.dropped.5........  |
>  ........pg.dropped.6........  |
>  bquantity                     |
>  ........pg.dropped.8........  |
>  ........pg.dropped.9........  |
>  id_position_root              |
>  id_conception                 |
>  barcode_unit                  |
>  id_unit_conversion_rule       |
>  ........pg.dropped.14........ |
>  timestamp                     |
>  on_freeze                     |
>  timestamp_class               |
>  name                          |
>  id_class_root                 |
>  id_group                      |
>  id_group_root                 |
>  id_object_carrier             |
>  desc                          |
>  ........pg.dropped.24........ |
>  ........pg.dropped.25........ |
>  ........pg.dropped.26........ |
>  id_class_prop_object_carrier  |
>  id_pos_temp_prop              |
>  ........pg.dropped.29........ |
>  mc                            |
>  is_inside                     | s

Hah ... that gave me the clue I needed.  If there are dropped
column(s) before the GENERATED one, pg_dump gets it wrong ---
but only in --inserts mode, not the default COPY mode, which
no doubt explains why nobody noticed.  There is code in there
to inject DEFAULT, but it must be indexing the flag array wrong.

Will fix, thanks for the report!

                        regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_dump insert column GENERATED
Next
From: Tom Lane
Date:
Subject: Re: insert column monetary type ver 2