pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Amit Langote <amitlangote09@gmail.com>
Cc: Petr Fedorov <petr.fedorov@phystech.edu>
Cc: PostgreSQL mailing lists <pgsql-bugs@postgresql.org>
Subject: Re: A row-level trigger on a partitioned table is not created on a sub-partition created later
Date: Wed, 18 Dec 2019 06:56:45 -0300
Message-ID: <20191218095645.GA9168@alvherre.pgsql> (raw)
In-Reply-To: <CA+HiwqFM2=i+uHB9o4OkLbE2S3sjPHoVe2wXuAD1GLJ4+Pk9eg@mail.gmail.com>

On 2019-Dec-18, Amit Langote wrote:

> Hello,
> 
> On Thu, Dec 5, 2019 at 4:24 PM Petr Fedorov <petr.fedorov@phystech.edu> wrote:
> > create table level1 (id1 integer not null, id2 integer not null, id3 integer not null) partition by list (id2);
> > create or replace function trigger_func() returns trigger language 'plpgsql' as $body$ begin raise exception 'fired'; return null; end $body$;
> > create trigger test_trigger after insert on level1 for each row execute procedure trigger_func();
> >
> > create table level2 partition of level1 for values in (1) partition by list (id3);
> > create table level3 partition of level2 for values in (1);
> >
> > insert into level1 values (1,1,1); -- row inserted
> >
> > psql \d+ shows that level3 does not have row level trigger while level2 and level1 have.
> 
> That is a bug. :(

Ouch.

> Alvaro, isn't marking triggers cloned to partitions "internal"
> unnecessary?  Because the cloned trigger on partition (level2 in above
> example) is marked internal, CloneRowTriggersToPartition() skips it
> when called on a sub-partition (level3 in above example).
> 
> Attached patch to fix that passes make check, although a bit surprised
> that it does.

IIRC that change would break pg_dump.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services





view thread (8+ messages)  latest in thread

Message-ID: <20191218095645.GA9168@alvherre.pgsql>
Permalink:  ../20191218095645.GA9168@alvherre.pgsql/
Also on:    postgresql.org/message-id/20191218095645.GA9168@alvherre.pgsql

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: alvherre@2ndquadrant.com, amitlangote09@gmail.com, petr.fedorov@phystech.edu
  Subject: Re: A row-level trigger on a partitioned table is not created on a sub-partition created later
  In-Reply-To: <20191218095645.GA9168@alvherre.pgsql>
  References: <CA+HiwqFM2=i+uHB9o4OkLbE2S3sjPHoVe2wXuAD1GLJ4+Pk9eg@mail.gmail.com> <20191218095645.GA9168@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox