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 1sFFny-000VAX-Si for pgsql-bugs@arkaria.postgresql.org; Thu, 06 Jun 2024 16:17:35 +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 1sFFmz-001j6G-FW for pgsql-bugs@arkaria.postgresql.org; Thu, 06 Jun 2024 16:16:34 +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 1sFFmz-001j4e-6m for pgsql-bugs@lists.postgresql.org; Thu, 06 Jun 2024 16:16:34 +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 1sFFmx-000Jt7-Js for pgsql-bugs@lists.postgresql.org; Thu, 06 Jun 2024 16:16:33 +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 456GGSsa1025642; Thu, 6 Jun 2024 12:16:28 -0400 From: Tom Lane To: fuboat@outlook.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18496: Strange Handling for Circular Views and Permissions in PostgreSQL In-reply-to: <18496-62ecca730bfdfceb@postgresql.org> References: <18496-62ecca730bfdfceb@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Thu, 06 Jun 2024 07:12:08 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1025640.1717690588.1@sss.pgh.pa.us> Date: Thu, 06 Jun 2024 12:16:28 -0400 Message-ID: <1025641.1717690588@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: > When a user without SELECT permissions tries to perform a select operation > on a circular view, PostgreSQL will report an error saying "infinite > recursion detected in rules for relation v2" instead of "permission denied > for view v2". Is this a bug or an unexpected behavior? [ shrug... ] Neither, I'd say. There are no specific restrictions on the order in which error checks are performed. > Regardless, a circular view is an invalid view and should not appear in > normal scenarios, so reporting this error message does not have any negative > impact. However, should this error take precedence over the SELECT > permission error, and could some important error messages potentially be > leaked in this way to users without permissions? It's hard to see how this leaks any information that's not readily available to everybody from the system catalogs (ie, "\d+ v1" and "\d+ v2"). regards, tom lane