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 1pjxef-0000zT-KF for pgsql-bugs@arkaria.postgresql.org; Wed, 05 Apr 2023 07:34:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pjxee-00041V-J3 for pgsql-bugs@arkaria.postgresql.org; Wed, 05 Apr 2023 07:34:04 +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 1pjxee-00041M-BA for pgsql-bugs@lists.postgresql.org; Wed, 05 Apr 2023 07:34:04 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pjxeb-000zat-0U for pgsql-bugs@lists.postgresql.org; Wed, 05 Apr 2023 07:34:03 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 5F7D65C029C; Wed, 5 Apr 2023 03:33:58 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 05 Apr 2023 03:33:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1680680038; x= 1680766438; bh=6VaeE+QJQoDuNYDSQ/xL9w53NMxrCkVsSbHYDF1CB4s=; b=N bxq/w5oe8YvJ2prHROGpF4vz39RujNSidWvzj8bYGZI4gyVR9CJFZfCmUoLq+VlO 5g4vICUcq1ibt2SyZvQKs43gDD0cRLeqLJdcmXrUS31jtF2YHY/2jsy7DTJJRua+ GM0NKwaGM13BAjHKhz7m6emmVgwtVG2QACvno88yARLfSZ+bnyOC7rKJLwGA0QEx WUOEHuNvmbeTYYHcsikQ/xXnqwE530ThbB7pW8dNNX7dptCVhU9+5nFcSgd7Ip8w 8wAYeQdCrfdnhuhmUeNxuuOFnLIswdZO3YQwhPqY4+HE69A9T6dVdnhEwg4UIW/W dfzZ2q/Ia2GzwuhBEHFYg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdejtddguddvtdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepfffhvfevuffkgggtugfgjgesth ekredttddtjeenucfhrhhomheptehlvhgrrhhoucfjvghrrhgvrhgruceorghlvhhhvghr rhgvsegrlhhvhhdrnhhoqdhiphdrohhrgheqnecuggftrfgrthhtvghrnhepvdektdffud fftdffffehfffhjeejhffgieeuueekjeekfffgudffhfduffffueevnecuffhomhgrihhn pegvnhhtvghrphhrihhsvggusgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurf grrhgrmhepmhgrihhlfhhrohhmpegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdho rhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 5 Apr 2023 03:33:57 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 7F679A1; Wed, 5 Apr 2023 09:33:56 +0200 (CEST) Date: Wed, 5 Apr 2023 09:33:56 +0200 From: Alvaro Herrera To: Tom Lane Cc: jazz001319@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17886: Error disabling user triggers on a partitioned table Message-ID: <20230405073356.boweefqo5ec4dfhe@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1582614.1680632672@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2023-Apr-04, Tom Lane wrote: > PG Bug reporting form writes: > > result: > > postgres=# alter table public.test DISABLE TRIGGER USER; > > ERROR: 42704: trigger "trigger_test" for table "test_def" does not exist > > LOCATION: EnableDisableTriggerNew, trigger.c:1658 > > > Expected Result (Postgresql 15.2 and 14.4 - fine): > > testdb=> alter table public.test DISABLE TRIGGER USER; > > ALTER TABLE > > Commit ec0925c22 seems to have been quite snakebit. No kidding :-( Clearly, commit 86f575948c77 ("Allow FOR EACH ROW triggers on partitioned tables") should have included more tests. > I already fixed > a deficiency in it in v15/HEAD, but here we have a different symptom > in the older branches. What's happening is that EnableDisableTrigger > is ignoring the child trigger because it has tgisinternal set to true > and the command passes skip_system = true. Hmm, right. > I'm inclined to think that in the older branches (pre f4566345c) > we need to do > > - if (oldtrig->tgisinternal) > + if (oldtrig->tgisinternal && !OidIsValid(oldtrig->tgparentid)) > { > /* system trigger ... ok to process? */ > > but I've not tested that. Alvaro, what do you think? Oh, that's a nice and clean solution. I tested it (on 13 and 14) and it does solve the problem, and no regression tests fail, but I didn't try to break it further. 12 and back are unaffected, for lack of 86f575948c77. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ "Nadie está tan esclavizado como el que se cree libre no siéndolo" (Goethe)