Re: bug: virtual generated column can be partition key - Mailing list pgsql-hackers

From jian he
Subject Re: bug: virtual generated column can be partition key
Date
Msg-id CACJufxG0aEwkWhugZAjQrSU7BE3zC7ozsJMqRbAyb9rNTGD7SA@mail.gmail.com
Whole thread Raw
In response to Re: bug: virtual generated column can be partition key  (Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>)
Responses Re: bug: virtual generated column can be partition key
List pgsql-hackers
On Tue, Apr 22, 2025 at 11:45 AM Ashutosh Bapat
<ashutosh.bapat.oss@gmail.com> wrote:
>
>
> While looking at this I realised that a generated column may end up being part of the partition key if the partition
keyexpression contains a whole row reference. Attached patch also has a fix and a testcase for the same. PARTITION BY
RANGE((gtest_part_key is not null)) expression in the test is kinda silly, but it tests the whole-row reference as part
ofan expression. I haven't looked for more sensible expressions. 
>

I begin to wonder if wholerow reference should be allowed.
then error occurred:

drop table if exists t4;
CREATE TABLE t4(f1 int, f2 bigint) PARTITION BY list ((t4));
create table t4_1 partition of t4 for values in ((1,2));
alter table t4 alter column f2 set data type text using f2;

insert into t4 select 1, '2';
ERROR:  invalid memory alloc request size 18446744073709551615



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Add pg_get_injection_points() for information of injection points
Next
From: vignesh C
Date:
Subject: Re: Logical Replication of sequences