Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rLluw-000J6g-D0 for pgsql-bugs@arkaria.postgresql.org; Fri, 05 Jan 2024 15:15:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rLltx-001AB3-F4 for pgsql-bugs@arkaria.postgresql.org; Fri, 05 Jan 2024 15:14:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rLltx-001A99-6t for pgsql-bugs@lists.postgresql.org; Fri, 05 Jan 2024 15:14:25 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rLltu-0000bL-PC for pgsql-bugs@lists.postgresql.org; Fri, 05 Jan 2024 15:14:24 +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 405FEHGc946636; Fri, 5 Jan 2024 10:14:17 -0500 From: Tom Lane To: vost_800@gmx.de cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18271: Re: Postgres policy exists bug In-reply-to: <18271-70059a372db705e3@postgresql.org> References: <18271-70059a372db705e3@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Fri, 05 Jan 2024 14:05:59 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <946634.1704467657.1@sss.pgh.pa.us> Date: Fri, 05 Jan 2024 10:14:17 -0500 Message-ID: <946635.1704467657@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > After submitting my initial report, I attempted to find a workaround for the > issue. However, during this process, I discovered the same behavior as with > the EXISTS operation, specifically when dealing with subqueries. Neither here nor in the other thread have you provided a *self-contained* example of what you think is wrong. I experimented with a function like your example here and couldn't see anything that looked wrong to me. As far as this bit goes: > FALSE IN ( > SELECT is_private > FROM public.profiles AS p > WHERE p.user_id = user_id > ) you do realize that "user_id" here will be resolved as p.user_id because that's the most closely nested source of such a column? So that WHERE clause will not provide any useful filter. Your function example doesn't have that bug, but your original policy definition looks like it might. regards, tom lane