Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m4Vtb-00068B-Ci for pgsql-hackers@arkaria.postgresql.org; Fri, 16 Jul 2021 22:01:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m4VtZ-0005Wl-7a for pgsql-hackers@arkaria.postgresql.org; Fri, 16 Jul 2021 22:01:21 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m4VtY-0005Wd-Vx for pgsql-hackers@lists.postgresql.org; Fri, 16 Jul 2021 22:01:20 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m4VtW-0004Sn-HZ for pgsql-hackers@postgresql.org; Fri, 16 Jul 2021 22:01:20 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 155895C009B; Fri, 16 Jul 2021 18:01:17 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Fri, 16 Jul 2021 18:01:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=hB4gI7WfZcsyWk/FJRGFehdHIJS4g+l+kMnY5Pnguoo=; b=lFkkMn5j gOwzJtBIg7qEO/pSh9njSpyl4SU0yGHfurqZbZYHgVLmIAdVEof4N0QIYrMDdwtt WlaFMaff9w5bm28EuhKIaJ60PI7bJbQuwBLYxLr/j9RbONQxZr3+6DIHFHGm20cl 9e9CkK1cHbnhrvzJyqXqMv2yCy2DctSZx6p9PdPcpf5R8r7Y4uHRDDDlrW3iAGqy Sq2ckzXyWTjdeIR18H6+K98zYtMtF3WwARQgdw1EDbi0n1wO4R2MAx/4XZOnet/v 7JfjnCyjGfCTsmuSkNvIpn5jhKKd12ND/Uhmu2nyppJs+jsVMkUBU8JCetePBijm +E15KOM3SxxV+w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvdeggddtudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgrrhho ucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgheqne cuggftrfgrthhtvghrnhepudejveejffejveduudetvdekieeuiedtvdeileefkeevjedu feeguedvjefhueelnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomhenuc evlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhvhhgv rhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 16 Jul 2021 18:01:15 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id ECBA62A097C; Fri, 16 Jul 2021 18:01:12 -0400 (-04) Date: Fri, 16 Jul 2021 18:01:12 -0400 From: Alvaro Herrera To: Justin Pryzby Cc: Tom Lane , pgsql-hackers@postgresql.org, Amit Langote Subject: Re: CREATE TABLE .. PARTITION OF fails to preserve tgenabled for inherited row triggers Message-ID: <202107162201.g243c7mnnxuy@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210716193319.GS20208@telsasoft.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2021-Jul-16, Justin Pryzby wrote: > CREATE TABLE p(i int) PARTITION BY RANGE(i); > CREATE TABLE p1 PARTITION OF p FOR VALUES FROM (1)TO(2); > CREATE FUNCTION foo() returns trigger LANGUAGE plpgsql AS $$begin end$$; > CREATE TRIGGER x AFTER DELETE ON p1 EXECUTE FUNCTION foo(); > CREATE TRIGGER x AFTER DELETE ON p EXECUTE FUNCTION foo(); Hmm, interesting -- those statement triggers are not cloned, so what is going on here is just that the psql query to show them is tripping on its shoelaces ... I'll try to find a fix. I *think* the problem is that the query matches triggers by name and parent/child relationship; we're missing to ignore triggers by tgtype. It's not great design that tgtype is a bitmask of unrelated flags ... -- Álvaro Herrera Valdivia, Chile — https://www.EnterpriseDB.com/