Re: MERGE/SPLIT PARTITIONS issues/questions

From: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: MERGE/SPLIT PARTITIONS issues/questions
Date: 2026-08-01 11:11:02
Message-ID: CAN4CZFNU63TASTAQO5U6iwq+bLaRbojEhxS=sCgwFtA9FqC0Nw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

> As a result, if the table contains generated
> columns, the data in the newly created partition may not be identical to the
> combined contents of the merged partitions.
>
> Therefore, when the partitioned table contains generated columns, we must
> reverify NOT NULL constraints, CHECK constraints, and foreign key constraints
> for ALTER TABLE ... MERGE PARTITION.

Yes, we can certainly can patch it this way. But should we? This
current behavior is inconsistent with how generated columns behave
with other SQL commands. That's why I didn't attach a patch in my
previous emails, I think the current way this behaves is wrong.

My proposal would be to reject MERGE if it would cause a difference in
generator expressions (or if it causes any other surprising changes),
and keep the exact definition of the partition for SPLIT. Otherwise we
end up with a surprising behavior in PG19, and if we want to fix it in
later releases, it'll be a significant behavior change between major
versions for the same command.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2026-08-01 15:05:36 BUG #19594: to_char/jsonpath format cache serves a format tree parsed in the wrong strict-mode
Previous Message jian he 2026-08-01 09:49:22 Re: MERGE/SPLIT PARTITIONS issues/questions

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2026-08-01 13:08:48 ANSI SQL proposal: SELECT DISTINCT ON (... ORDER BY ...) and UNION DISTINCT ON (... ORDER BY ...)
Previous Message jian he 2026-08-01 09:49:22 Re: MERGE/SPLIT PARTITIONS issues/questions