Re: FOR EACH ROW triggers on partitioned tables - Mailing list pgsql-hackers

From Robert Haas
Subject Re: FOR EACH ROW triggers on partitioned tables
Date
Msg-id CA+TgmoZtBLCd1TebU0W-WS0yYvjJXNtpS9ETKQ0w8UEYOKSAwQ@mail.gmail.com
Whole thread Raw
In response to Re: FOR EACH ROW triggers on partitioned tables  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Responses Re: FOR EACH ROW triggers on partitioned tables
List pgsql-hackers
On Tue, Jan 23, 2018 at 5:10 PM, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
> The main question is this: when running the trigger function, it is
> going to look as it is running in the context of the partition, not in
> the context of the parent partitioned table (TG_RELNAME etc).  That
> seems mildly ugly: some users may be expecting that the partitioning
> stuff is invisible to the rest of the system, so if you have triggers on
> a regular table and later on decide to partition that table, the
> behavior of triggers will change, which is maybe unexpected.  Maybe this
> is not really a problem, but I'm not sure and would like further
> opinions.

It doesn't seem either great or horrible.

Also, what about logical replication?  Amit just raised this issue for
the UPDATE row movement patch, and it seems like the issues are
similar here.  If somebody's counting on the same kinds of per-row
triggers to fire during logical replication as we do during the
original operation, they will be disappointed.

>> Also, does ALTER TABLE ... ENABLE/DISABLE TRIGGER do the right things on
>> partitioned tables?
>
> Haven't done this yet, either.  I like Simon's suggestion of outright
> disallowing this.

Why not just make it work?

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Would a BGW need shmem_access or database_connection toenumerate databases?
Next
From: Stephen Frost
Date:
Subject: Re: [HACKERS] Patch: Add --no-comments to skip COMMENTs with pg_dump