Re: FOR EACH ROW triggers on partitioned tables

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Simon Riggs <simon(at)2ndquadrant(dot)com>
Subject: Re: FOR EACH ROW triggers on partitioned tables
Date: 2018-01-24 18:22:14
Message-ID: CA+TgmoZtBLCd1TebU0W-WS0yYvjJXNtpS9ETKQ0w8UEYOKSAwQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 23, 2018 at 5:10 PM, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2018-01-24 18:24:19 Re: [HACKERS] Patch: Add --no-comments to skip COMMENTs with pg_dump
Previous Message Bruce Momjian 2018-01-24 18:20:49 Re: Would a BGW need shmem_access or database_connection to enumerate databases?