Re: disallow alter individual column if partition key contains wholerow reference

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: disallow alter individual column if partition key contains wholerow reference
Date: 2025-08-25 03:57:51
Message-ID: BC70B906-F2D3-4833-8F43-2C94FA0D0112@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Jian,

> On Aug 25, 2025, at 10:22, jian he <jian(dot)universality(at)gmail(dot)com> wrote:
>
>
> hi.
> minor comments changes,
> also add it on commitfest (https://commitfest.postgresql.org/patch/5988)
> <v2-0001-fix-wholerow-as-partition-key-reference.patch>

I tested this patch with “partition by range”, it works for me.

Just have a few small comments:

+ if (bms_is_member(0 - FirstLowInvalidHeapAttributeNumber, expr_attrs))

Can we simply check “if (Var *)expr->varno == 1 && (Var *) expr->varattno == 0”, which seems more direct?

+ /*
+ * If partition expression contains wholerow reference, then any
+ * column is indirect part of the expression now. unconditionally
+ * set used_in_expr to true.
+ */

For the comment, a tiny enhancement:

/*
* If the partition expression contains a whole-row reference, then every
* column is implicitly part of the expression. Set used_in_expr to true
* unconditionally.
*/

Best reagards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Chao Li 2025-08-25 03:59:22 Re: Fixes a trivial bug in dumped parse/query/plan trees
Previous Message Stepan Neretin 2025-08-25 03:20:19 Re: Fixes a trivial bug in dumped parse/query/plan trees