Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ihW4b-0002hB-Vn for pgsql-bugs@arkaria.postgresql.org; Wed, 18 Dec 2019 09:56:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ihW4a-0000cq-Po for pgsql-bugs@arkaria.postgresql.org; Wed, 18 Dec 2019 09:56:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ihW4a-0000cj-HD for pgsql-bugs@lists.postgresql.org; Wed, 18 Dec 2019 09:56:52 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ihW4X-00063T-Rm for pgsql-bugs@postgresql.org; Wed, 18 Dec 2019 09:56:52 +0000 Received: by mail-pg1-x543.google.com with SMTP id x7so978613pgl.11 for ; Wed, 18 Dec 2019 01:56:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=IG/YVclSIJtJp0g3EUdM7nW1XpTPk6H0kzbThtesrDA=; b=El4z6s4pQnOTG9e3efCxVH0wuyZ9GEr6XsgzfXwyKviuB9x21x59e/8emALbtjrQmm WHiDWjSEwM3E0rhsk56xwhWxuaiuxH+6pVUlkNEImwKYI63YQz73X6ZPeZ9WFgWDuktU oMq8Iu8svaAtrbYZJaxgx0lJFF8e2QjcpHPDdD0vjtO/7eirs8aJpe836RPG3VXSODOn m5rfMfAiCj/LHqszdqRzQbTo2o9xIHFelJvSC2+NcYGgwRkPUkIoVC16eLyl2jntgni7 mPwSxvzZqLg9CxHdXJMC60GMffuQm5p5WXWsN2b5CdMVYyX/ouuZL0bNuNCF+hoY8d/+ 2GXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=IG/YVclSIJtJp0g3EUdM7nW1XpTPk6H0kzbThtesrDA=; b=Dg7frUGdOBwYVtuzM2wqkrRDJ1pN6KSNifgxqKLUSGaR1Exme+G1l2UffzCEIrYvPZ 0XdopTi+A/q0v0/Yy7lv4aQV2JHZ711OpF5nyJqehrIw3Z3KHHlLk1vX/4xiyi+Ezo2j PPUZLBaVqc0302ot6TFUwJnjDXqoKv5+IC8PqQHiXge5ftCh8gunjgUSdqFsFarknuGo R5BXjB1n805ZhP5+i4VqU/0caGHmJKMeyFnTKnkTn8LXEEct/8GVHNpuTeQ/tjteztoS +EhraFu2i8AOT8awPzmEbxzVd6or1KyJCbVg1GBMIJNV5mXXFLeuuIiFt/eJZ3k/DH1J jm3w== X-Gm-Message-State: APjAAAWF0GnGOx1Vch7boI19UsEBIqQu6BuN7e4+ZF7+C2FKJp6lX1kv 6OZJuza+yq/NTAx69O6l4rDEpc4rAaS1FQ== X-Google-Smtp-Source: APXvYqwcRNkW6scO+RAkYU1DzUzlMrMCX0+OGfBVBsVnMVQJ5vA2IuDLErOhVMysJONv+H2zL6iRGw== X-Received: by 2002:a63:5b0a:: with SMTP id p10mr2052097pgb.228.1576663007932; Wed, 18 Dec 2019 01:56:47 -0800 (PST) Received: from nimloth.alvh.no-ip.org ([190.95.19.128]) by smtp.gmail.com with ESMTPSA id in19sm1990025pjb.11.2019.12.18.01.56.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2019 01:56:47 -0800 (PST) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 201EE300804; Wed, 18 Dec 2019 06:56:45 -0300 (-03) Date: Wed, 18 Dec 2019 06:56:45 -0300 From: Alvaro Herrera To: Amit Langote Cc: Petr Fedorov , PostgreSQL mailing lists Subject: Re: A row-level trigger on a partitioned table is not created on a sub-partition created later Message-ID: <20191218095645.GA9168@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2019-Dec-18, Amit Langote wrote: > Hello, > > On Thu, Dec 5, 2019 at 4:24 PM Petr Fedorov 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