Error for row-level triggers with transition tables on partitioned tables

From: Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Error for row-level triggers with transition tables on partitioned tables
Date: 2022-10-31 09:27:53
Message-ID: CAPmGK17gk4vXLzz2iG+G4LWRWCoVyam70nZ3OuGm1hMJwDrhcg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

While working on something else, I noticed $SUBJECT: we do not
currently allow row-level triggers on partitioned tables to have
transition tables like this:

create table parted_trig (a int) partition by list (a);
CREATE TABLE
create function trigger_nothing() returns trigger language plpgsql as
$$ begin end; $$;
CREATE FUNCTION
create trigger failed after update on parted_trig referencing old
table as old_table for each row execute procedure trigger_nothing();
ERROR: "parted_trig" is a partitioned table
DETAIL: Triggers on partitioned tables cannot have transition tables.

but the DETAIL message is confusing, because statement-level triggers
on partitioned tables *can* have transition tables.

We do not currently allow row-level triggers on partitions to have
transition tables either, and the error message for that is “ROW
triggers with transition tables are not supported on partitions.”.
How about changing the DETAIL message to something similar to this
like “ROW triggers with transition tables are not supported on
partitioned tables.”, to avoid confusion? Patch attached. Will add
this to the upcoming CF.

Best regards,
Etsuro Fujita

Attachment Content-Type Size
fix-trigger-error-message.patch application/octet-stream 1.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2022-10-31 09:51:36 Re: ResourceOwner refactoring
Previous Message Peter Eisentraut 2022-10-31 09:02:35 Re: Simplifying our Trap/Assert infrastructure