Re: bug: virtual generated column can be partition key
Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
From: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
To: jian he <jian.universality@gmail.com>
Cc: Fujii Masao <masao.fujii@oss.nttdata.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-04-22T06:20:11Z
Lists: pgsql-hackers
On Tue, Apr 22, 2025 at 11:19 AM jian he <jian.universality@gmail.com> wrote: > 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 key expression 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 of an > 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 > I can reproduce this error without my patc. It seems to be a different existing bug. -- Best Wishes, Ashutosh Bapat
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Tighten check for generated column in partition key expression
- 7f239c72a897 13.23 landed
- 04345d7a423a 14.20 landed
- 643a5e96c788 15.15 landed
- 7180d56c5609 16.11 landed
- 0b44f2443f69 17.7 landed
- ba99c9491c44 18.1 landed
- 040cc5f3c782 19 (unreleased) landed
-
Stamp 18beta1.
- caa76b91a606 18.0 cited