Re: virtual generated column as partition key

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: virtual generated column as partition key
Date: 2026-03-04 08:00:46
Message-ID: CACJufxFF0iDPU4m5OgJh4rRa5mm09dW9agyjYEzekURZ=4yRbw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi.

Rebasing and rechecking the code changes again.

typedef struct PartitionKeyData
{
PartitionStrategy strategy; /* partitioning strategy */
int16 partnatts; /* number of columns in the partition key */
AttrNumber *partattrs;
List *partexprs;
....
}

Normally, a partition key is mutually exclusive: it is either a simple column
(partattrs[i] != 0 and partexprs[i] == NULL) or an expression (partattrs[i] == 0
with partexprs[i] != NULL). However, for virtual generated columns, it's
possible for both to exist (partattrs[i] != 0 and partexprs[i] != NULL).

Because of this scenario, I have double checked all occurrences of
`->partattrs` in the codebase to ensure partition keys with virtual generated
columns are handled properly.

--
jian
https://www.enterprisedb.com/

Attachment Content-Type Size
v4-0001-virtual-generated-column-as-partition-key.patch text/x-patch 49.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2026-03-04 08:05:24 Re: Need to install liblz4-dev
Previous Message paul.bunn 2026-03-04 08:00:39 [BUG + PATCH] DSA pagemap out-of-bounds in make_new_segment odd-sized path