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 1n9chV-0005R4-1c for pgsql-hackers@arkaria.postgresql.org; Tue, 18 Jan 2022 00:50:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n9chS-0001lU-VU for pgsql-hackers@arkaria.postgresql.org; Tue, 18 Jan 2022 00:50:14 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n9chS-0001lJ-M5 for pgsql-hackers@lists.postgresql.org; Tue, 18 Jan 2022 00:50:14 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n9chQ-0004g0-Ml for pgsql-hackers@postgresql.org; Tue, 18 Jan 2022 00:50:13 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 20I0o8r1168138; Mon, 17 Jan 2022 19:50:08 -0500 From: Tom Lane To: Justin Pryzby cc: Alvaro Herrera , pgsql-hackers@postgresql.org, Amit Langote Subject: Re: \d with triggers: more than one row returned by a subquery used as an expression In-reply-to: <163710.1642464874@sss.pgh.pa.us> References: <20211217154356.GJ17618@telsasoft.com> <20211222210308.GD17618@telsasoft.com> <152507.1642456920@sss.pgh.pa.us> <20220118000824.GC14051@telsasoft.com> <163710.1642464874@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Mon, 17 Jan 2022 19:14:34 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <168136.1642467008.1@sss.pgh.pa.us> Date: Mon, 17 Jan 2022 19:50:08 -0500 Message-ID: <168137.1642467008@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I wrote: > Justin Pryzby writes: >> Is there any reason why WITH ORDINALITY can't work ? >> This is passing the smoke test. > How hard did you try to break it? It still seems to me that > this can be fooled by an unrelated trigger with the same tgname. Hmm ... no, it does work, because we'll stop at the first trigger with tgparentid = 0, so unrelated triggers further up the partition stack don't matter. But this definitely requires commentary. (And I'm not too happy with burying such a complicated thing inside a conditional inside a printf, either.) Will see about cleaning it up. regards, tom lane