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 1iclUv-00038c-FD for pgsql-bugs@arkaria.postgresql.org; Thu, 05 Dec 2019 07:24:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iclUs-0000Ac-N3 for pgsql-bugs@arkaria.postgresql.org; Thu, 05 Dec 2019 07:24:22 +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 1iclUs-000064-8W for pgsql-bugs@lists.postgresql.org; Thu, 05 Dec 2019 07:24:22 +0000 Received: from mail-lf1-x143.google.com ([2a00:1450:4864:20::143]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iclUp-0000h0-4Q for pgsql-bugs@postgresql.org; Thu, 05 Dec 2019 07:24:21 +0000 Received: by mail-lf1-x143.google.com with SMTP id 203so1631670lfa.12 for ; Wed, 04 Dec 2019 23:24:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=phystech-edu.20150623.gappssmtp.com; s=20150623; h=from:autocrypt:to:subject:message-id:date:user-agent:mime-version :content-language; bh=jR45bbU0kmJ2jUE0HHXibVLDgOH9EY+kiBmp+Ud6/8A=; b=hVoyxxG27emNbFkdAiLJOK0KQWoSofNeow2lqpm7TnPO7XtQ64EZYrumuS5vIDDwh7 sCrMZRmi5d/5JMWw2bR4KsRvebQHi11l4HP1x8ELQ3vUNZZgkHd6ezzmrSpUuoTChMPH 3RFZl9VlFT9hEjO/HGd5tssu94xtgNz3oT690AErDw1y3XLubXJklDGLCHFlnqK4AtZ/ hkQ1xJwKjYodaNm4w9cMe9MCAkWbJZtGvfTk3K9zQfimr/p3MaerWZlSUGBu/6vAnMxB sudnT0Mp5Hc9RfdqVQX3VL88xjibWiRhDVgsJLR0vqcoSJ44aE2Vf6PrzSpdXVjTLamG /qdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:autocrypt:to:subject:message-id:date :user-agent:mime-version:content-language; bh=jR45bbU0kmJ2jUE0HHXibVLDgOH9EY+kiBmp+Ud6/8A=; b=J1F0BFu8eYLvyY97lOFdxj1kuCGzOJKm41HXsDGP2BuNgbICobrb2tvFlZ3n4YVrXN 7N4l1jDXpqlA+/VFuZ+t14+9xOrZlIjY159RUdYFk73feS+BPHMyukG0ZPD6BezwYycz QybM7NuJSHKdqLlrWyrc19+N/THRBvzkt8hX5jwHChdiV5E+mTSD5YqjLeMzfs0TAITf 78BVk7aeN7iELQr15qxSdOlNh0OxVQ8uYgDW+5YRJ+I5m0XmOyULVFHkGznt0MNVEu8r ajIARy3E48kbxvwiMUklUfczIPtfUjK+qcTNa5L8VZu8/pQJ08N9wq2SenSdDRFU1YYB bBtg== X-Gm-Message-State: APjAAAVaI4KcszBh8nkU4VCVCs0oHzbX6dqSVjL7D5gfYcxozgz6h+8A sOt++RZxYAzVAjgpVHdBNcy3VmKwWCg= X-Google-Smtp-Source: APXvYqxLZ/TCGRT3p76UIkCGO17yaBTSk/EJZfBT0+m7U/zenW0rDcnvjU159zeYQeYui688nikPzw== X-Received: by 2002:ac2:489b:: with SMTP id x27mr4515983lfc.130.1575530657791; Wed, 04 Dec 2019 23:24:17 -0800 (PST) Received: from [192.168.13.6] (broadband-109-173-39-29.ip.moscow.rt.ru. [109.173.39.29]) by smtp.gmail.com with ESMTPSA id m24sm4454509lfl.34.2019.12.04.23.24.16 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Dec 2019 23:24:17 -0800 (PST) From: Petr Fedorov Autocrypt: addr=petr.fedorov@phystech.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sY61NH Fkgmb6jU+hDm0vV4l7Bn/0l756nt9nnt8VV7NNgvV63BVfyIHrJvm0yGQhXF86yWB7+XZx/F 0KLlZSoGpzFJfk6qSgLSnqFfI2OpXY7Vo49SsSyx7+UAEQEAAYkBHwQYAQIACQUCV6Y5cgIb DAAKCRAj1ZnYhMoBPueACAC9EHwB3a9UBHI8haKw3kGZbqOBthz1SLHCgFsw/jxGbWKC2cCa 9PL6ArCBvQelVOgkxfxN4gmQTFcwTD8AiTU3IffJxz8nFv/NRJptvUsPPhehmYGd2zp6D4O8 Gc/2JUgGcm0eNhhxqZAlSlzTAtHM23I4/yTiHgyiyawq7yQknLedgVkwsH+HTsHWYR0X4kg4 eErbPNj/B3+ZUAg9A6tRQOg9+B903gKsgtQacaTRSVA74kzaLNa4yevq97O0fBSSePCvX+Ti z7xx67iuIxa+yuZrzW2+itA6E5wLgfacBFkP8vZn4YrvA1MX0BP3iRCXxlNMr/D/rXgMKAya 6D03 To: pgsql-bugs@postgresql.org Subject: A row-level trigger on a partitioned table is not created on a sub-partition created later Message-ID: <6b3f0646-ba8c-b3a9-c62d-1c6651a1920f@phystech.edu> Date: Thu, 5 Dec 2019 10:24:16 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------------F8EA2831DBA0C6F30D51E1DA" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------F8EA2831DBA0C6F30D51E1DA Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello, According to the documentation ,=C2=A0 creati= ng a row-level trigger on a partitioned table will cause identical triggers to be created in all its existing partitions; and any partitions created or attached later will contain an identical trigger, too. It does not happen for a sub-partition - partition of partition - when it is created/attached later.=C2=A0 Steps to reproduce (11.6, Centos 7): create table level1 (id1 integer not null, id2 integer not null, id3 integer not null) partition by list (id2); create table level2 partition of level1 for values in (1) partition by list (id3); create table level3 partition of level2 for values in (1); 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(); insert into level1 values (1,1,1);=C2=A0 -- fails as expected due to test_trigger(); drop table level1; drop function trigger_func(); 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. --------------F8EA2831DBA0C6F30D51E1DA Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit

Hello,

According to the documentation,  creating a row-level trigger on a partitioned table will cause identical triggers to be created in all its existing partitions; and any partitions created or attached later will contain an identical trigger, too.

It does not happen for a sub-partition - partition of partition - when it is created/attached later.  Steps to reproduce (11.6, Centos 7):

create table level1 (id1 integer not null, id2 integer not null, id3 integer not null) partition by list (id2);
create table level2 partition of level1 for values in (1) partition by list (id3);
create table level3 partition of level2 for values in (1);
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();

insert into level1 values (1,1,1);  -- fails as expected due to test_trigger();

drop table level1;
drop function trigger_func();

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.




--------------F8EA2831DBA0C6F30D51E1DA--