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 1oquRQ-0003xj-HS for pgsql-bugs@arkaria.postgresql.org; Fri, 04 Nov 2022 11:00:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oquRP-0004vn-AY for pgsql-bugs@arkaria.postgresql.org; Fri, 04 Nov 2022 11:00:51 +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 1oquRO-0004sP-Co for pgsql-bugs@lists.postgresql.org; Fri, 04 Nov 2022 11:00:51 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oquRL-000090-OV for pgsql-bugs@lists.postgresql.org; Fri, 04 Nov 2022 11:00:49 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 5A2195C0186; Fri, 4 Nov 2022 07:00:44 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 04 Nov 2022 07:00:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :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=fm3; t=1667559644; x=1667646044; bh=Y XgmJ/tw4i6rJ5ol6mLXbvn/GZzW017Wd/gOQZ2a094=; b=D98NejxgLRjMCB2TV YpfKEFOKs4qJ5LS7uF8TKA8PN6y4bKm6nn0kKmPEjIvXOFJ/DqQ4UVTSNmJHqJDk +Cgp+HTIEprY9mbKGFKJOR44rQ05QxtwAI50fUrZQOjXqDpFMEQ4mztSRwfRydS+ Gy1sFF78+OoTJAwubZ0BpOGGwEZXYg9hUEauuUO2sy9Q2lkUR33qCUa4FArHmP0E jzWyhviwDu8t0pJXpUB5QVUfyB4uBVKhlM2zPWsXU8Ja+KETSl6fsDUy0T4Numqa f7deoF8zH0Qg93aQleAK5L3eEL8WVzud1Y7JYwLbQ1K3nlgM8Oi7sQAt+ujI152X kRyFg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvddugddvtdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvvefukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpeetlhhvrghr ohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgqe enucggtffrrghtthgvrhhnpedvudeftdfgvedvgfffgefhveduvdeghfdugedufffhgedu udettedthfdvgeffheenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmpd htfihithhtvghrrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehm rghilhhfrhhomheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Nov 2022 07:00:43 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id BB29A409; Fri, 4 Nov 2022 12:00:41 +0100 (CET) Date: Fri, 4 Nov 2022 12:00:41 +0100 From: Alvaro Herrera To: Tom Lane Cc: Bruce Momjian , "David G. Johnston" , "lxndrkrlv@gmail.com" , "pgsql-bugs@lists.postgresql.org" Subject: Re: BUG #17233: Incorrect behavior of DELETE command with bad subquery in WHERE clause Message-ID: <20221104110041.3a6tngpyqzod4p4p@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4158934.1661104235@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I gave this a quick spin and couldn't find any faults. The bit about getting an incorrect hint when p_rel_visible is false had me busy for a little while (specifically I ran into it with the "unnamed_subquery" stuff added by commit bcedd8f5fce0), but maybe that's a fringe enough case, as the comment in rte_visible_if_lateral says. I did wonder why errorMissingColumn doesn't consider rte_visible_if_* in the case when there *is* an rsecond candidate. I understand that the reason is that if we come across any exact match we already return that one without looking for a second one. Maybe this deserves a comment (in errorMissingColumn I mean) but I also wonder if we shouldn't scan the whole RT in case there's another exact match that's also not visible. -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/ "Learn about compilers. Then everything looks like either a compiler or a database, and now you have two problems but one of them is fun." https://twitter.com/thingskatedid/status/1456027786158776329