Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1emDvz-0008Tt-2H for pgsql-hackers@arkaria.postgresql.org; Thu, 15 Feb 2018 07:26:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1emDvx-0007O3-P3 for pgsql-hackers@arkaria.postgresql.org; Thu, 15 Feb 2018 07:26:21 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1emDvx-0007No-Hy for pgsql-hackers@lists.postgresql.org; Thu, 15 Feb 2018 07:26:21 +0000 Received: from tama500.ecl.ntt.co.jp ([129.60.39.148]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1emDvt-0005G4-CG for pgsql-hackers@postgresql.org; Thu, 15 Feb 2018 07:26:21 +0000 Received: from vc2.ecl.ntt.co.jp (vc2.ecl.ntt.co.jp [129.60.86.154]) by tama500.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id w1F7Q8Lf030258; Thu, 15 Feb 2018 16:26:08 +0900 Received: from vc2.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id 5E1F9638F3B; Thu, 15 Feb 2018 16:26:08 +0900 (JST) Received: from jcms-pop21.ecl.ntt.co.jp (jcms-pop21.ecl.ntt.co.jp [129.60.87.134]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id 52D1A638F1B; Thu, 15 Feb 2018 16:26:08 +0900 (JST) Received: from [127.0.0.1] (unknown [129.60.241.61]) by jcms-pop21.ecl.ntt.co.jp (Postfix) with ESMTPSA id 3429F400950; Thu, 15 Feb 2018 16:26:08 +0900 (JST) Subject: Re: FOR EACH ROW triggers on partitioned tables References: <20180214212624.hm7of76flesodamf@alvherre.pgsql> From: Amit Langote Message-ID: <77d52cfc-76d4-91ea-da90-ff2dc2db6f6b@lab.ntt.co.jp> Date: Thu, 15 Feb 2018 16:25:54 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180214212624.hm7of76flesodamf@alvherre.pgsql> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CC-Mail-RelayStamp: 1 To: Alvaro Herrera , Robert Haas Cc: Peter Eisentraut , Pg Hackers , Simon Riggs X-TM-AS-MML: disable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2018/02/15 6:26, Alvaro Herrera wrote: > Another option is to rethink this feature from the ground up: instead of > cloning catalog rows for each children, maybe we should have the trigger > lookup code, when running DML on the child relation (the partition), > obtain trigger entries not only for the child relation itself but also > for its parents recursively -- so triggers defined in the parent are > fired for the partitions, too. I'm not sure what implications this has > for constraint triggers. > > The behavior should be the same, except that you cannot modify the > trigger (firing conditions, etc) on the partition individually -- it > works at the level of the whole partitioned table instead. Do you mean to fire these triggers only if the parent table (not a child table/partition) is addressed in the DML, right? If the table directly addressed in the DML is a partition whose parent has a row-level trigger, then that trigger should not get fired I suppose. Thanks, Amit