Re: Proposal: Cascade REPLICA IDENTITY changes to leaf partitions

Поиск
Список
Период
Сортировка
От Amit Kapila
Тема Re: Proposal: Cascade REPLICA IDENTITY changes to leaf partitions
Дата
Msg-id CAA4eK1JbyjxbL09-9KDNonFtG_GA54+wz00SZGyzNRTLaCv-Ag@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Proposal: Cascade REPLICA IDENTITY changes to leaf partitions  (Chao Li <li.evan.chao@gmail.com>)
Список pgsql-hackers
On Fri, Dec 12, 2025 at 9:28 AM Chao Li <li.evan.chao@gmail.com> wrote:
>
> Hi Amit,
>
> Thanks for pointing out that my assumption of “RI of parent is not used” is not always true.
>
> I agree that automatic-cascade will introduce a lot of complexities. To ensure the backward-compatibility, how about
toextend the ALTER TABLE syntax like: 
>
> ```
> ALTER TABLE <root> REPLICA IDENTITY <type> [CASCADE | FORCE CASCADE]
> ```
>

CASCADE is used for dependent objects, so I don't think using it will
be appropriate in this context. However, the INHERIT (NO INHERIT)
could be used. We already use them for constraints, see ALTER TABLE
... ALTER CONSTRAINT syntax in docs.

> So, that the current syntax will behave the same as usual, and
>
> With CASCADE
> ============
> 1. Root's RI updated
> 2. All children (including middle partitioned tables and leaf tables) RI updated unless 3
> 3. If any child’s RI is different from the root's RI, fail out, no change happens
>
> With CASCADE FORCE
> ===================
> 1. Root's RI updated
> 2. All children (including middle partitioned tables and leaf tables) RI updated, prints a warning message when a
child’sRI is different from root’s RI 
>

I think you can try to experiment with CHECK or NOT NULL constraint
behavior for similar cases in case of partition tables.

BTW, did you get this use case in the field or just browsing docs, you
thought it would be useful to have such a feature?

--
With Regards,
Amit Kapila.



В списке pgsql-hackers по дате отправления: