| From: | jian he <jian(dot)universality(at)gmail(dot)com> |
|---|---|
| To: | Kirill Reshke <reshkekirill(at)gmail(dot)com> |
| Cc: | Matt Dailis <dwehttam(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
| Subject: | Re: disallow alter individual column if partition key contains wholerow reference |
| Date: | 2025-12-31 02:57:14 |
| Message-ID: | CACJufxG3ffzbD65J1p2xGH5P=TmW7hH6BAyuNB65tRVN_Xk03w@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Tue, Oct 28, 2025 at 11:24 PM Kirill Reshke <reshkekirill(at)gmail(dot)com> wrote:
>
> I can see that 0 - FirstLowInvalidHeapAttributeNumber is an existing
> coding practise in sources, but so is
> InvalidAttrNumber - FirstLowInvalidHeapAttributeNumber (sepgsql
> contrib extension). I'm voting for the second one, even though it is
> less used.
>
hi.
now it's:
+ /*
+ * If the partition expression contains a whole-row reference,
+ * then all columns are indirectly associated with that
+ * expression.
+ */
+ if (bms_is_member(InvalidAttrNumber -
FirstLowInvalidHeapAttributeNumber,
+ expr_attrs))
+ {
+ if (used_in_expr)
+ *used_in_expr = true;
+ return true;
+ }
also polished the commit message. below is the commit message:
--------------------------
For partition key expressions containing whole-row reference, we cannot rely on
pg_depend lookups to determine whether an individual column can be altered
(drop, set data type).
As noted in the comments for find_expr_references_walker, no dependency entries
are recorded for whole-row expressions. Therefore whole-row reference check is
needed in has_partition_attrs.
Partition key expressions contain whole-row reference, it is effectively
equivalent to all user columns being indirectly associated with that expression.
Since columns that in a partition key cannot be altered in any way, the same
restriction should be applied to whole-row reference expressions in the
partition key.
--------------------------
| Attachment | Content-Type | Size |
|---|---|---|
| v3-0001-disallow-altering-column-if-partition-key-contains-wholerow-refer.patch | text/x-patch | 4.8 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Chao Li | 2025-12-31 03:36:56 | Re: Fix comments on _bt_skiparray_strat_increment/decrement |
| Previous Message | zengman | 2025-12-31 02:36:05 | Re: Speed up ICU case conversion by using ucasemap_utf8To*() |