Re: CREATE TABLE LIKE INCLUDING TRIGGERS

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Cc: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: CREATE TABLE LIKE INCLUDING TRIGGERS
Date: 2026-02-05 06:15:25
Message-ID: CACJufxGTxbpbaQjUxc69-Dovx6+KJd=81T5111uizUrdsEkDNQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jan 22, 2026 at 10:20 PM Zsolt Parragi
<zsolt(dot)parragi(at)percona(dot)com> wrote:
>
> After looking into this a bit more, I am more on the side of copying
> this setting properly.
>
> The already existing INCLUDING CONSTRAINTS copies the constraints,
> including their enabled/disabled status, correctly marking them
> disabled if a CHECK constraint is defined but not enforced. Wouldn't
> it be strange for INCLUDING TRIGGERS to work differently?
>

hi.
please check the attached.

v6-0001 is the same as v5-0001.
v6-0002 ensures that CREATE TABLE ... LIKE ... INCLUDING TRIGGERS
correctly copies the tgenabled status from the source table's triggers
to the new table

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

Attachment Content-Type Size
v6-0002-create-table-like-including-triggers-copies-tgenabled.patch text/x-patch 7.8 KB
v6-0001-CREATE-TABLE-LIKE-INCLUDING-TRIGGERS.patch text/x-patch 41.8 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message zengman 2026-02-05 06:51:05 Small fixes for incorrect error messages
Previous Message Richard Guo 2026-02-05 06:09:17 Re: Convert NOT IN sublinks to anti-joins when safe