Re: Generated column and partitioning bug

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Maxim Gasumyants <m(at)gasumyants(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: Generated column and partitioning bug
Date: 2022-02-04 19:00:18
Message-ID: 420367.1644001218@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Maxim Gasumyants <m(at)gasumyants(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Maxim Gasumyants 2022-02-04 20:52:06 Re: Generated column and partitioning bug
Previous Message Maxim Gasumyants 2022-02-04 18:12:00 Re: Generated column and partitioning bug