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

From Maxim Gasumyants
Subject Re: Generated column and partitioning bug
Date
Msg-id D2EAC918-CE2D-4D75-B51D-919C0A0665CB@gasumyants.com
Whole thread Raw
In response to Re: Generated column and partitioning bug  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
You are right - we were using 12.2, just I didn’t confirmed it well.

Thank you so much, Tom.

4 февр. 2022 г., в 21:00, Tom Lane <tgl@sss.pgh.pa.us> написал(а):

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: Tom Lane
Date:
Subject: Re: Generated column and partitioning bug
Next
From: Thomas Munro
Date:
Subject: Re: BUG #17391: While using --with-ssl=openssl and PG_TEST_EXTRA='ssl' options, SSL tests fail on OpenBSD 7.0