Re: Generated column and partitioning bug - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Generated column and partitioning bug
Date
Msg-id 420367.1644001218@sss.pgh.pa.us
Whole thread Raw
In response to Generated column and partitioning bug  (Maxim Gasumyants <m@gasumyants.com>)
Responses Re: Generated column and partitioning bug
List pgsql-bugs
Maxim Gasumyants <m@gasumyants.com> writes:
> I will check version once more - I wrote that it latest version based on the thing, that yum does not pull any
updates.Here is the command for main table and partitioned table: 

> p-# where attrelid = 'products_product_offers'::regclass and attnum > 0;
>             attname            | attnum | attisdropped
> -------------------------------+--------+--------------
>  id                            |      1 | f
>  shop_id                       |      2 | f
>  ........pg.dropped.3........  |      3 | t
>  parent_id                     |      4 | f
>  ........pg.dropped.5........  |      5 | t
>  currency_id                   |      6 | f
>  article                       |      7 | f
>  name                          |      8 | f
>  type                          |      9 | f
>  image                         |     10 | f
>  barcodes                      |     11 | f
>  sku                           |     12 | f
>  dimensions                    |     13 | f
>  weight                        |     14 | f
>  purchasingprice               |     15 | f

Hm, I think that confirms my idea about the underlying nature of the bug.
The parent's stored expression for volume would refer to dimensions as
being var 13.  Now, when you create a new child partition it would have no
dropped columns, so that dimensions would be column 11 and purchasingprice
would be column 13 in the child.  Thus, the observed symptom is explained
if we failed to renumber the vars in the GENERATED expression while copying
it to the child partition.

However, AFAICT we do that correctly.  I didn't bisect, but I think
this was fixed by commit d9253df12, which shipped in PG 12.5.
Please double-check your server version, eg with "select version();"

            regards, tom lane



pgsql-bugs by date:

Previous
From: Maxim Gasumyants
Date:
Subject: Re: Generated column and partitioning bug
Next
From: Maxim Gasumyants
Date:
Subject: Re: Generated column and partitioning bug