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 1snu37-006ppr-U4 for pgsql-general@arkaria.postgresql.org; Tue, 10 Sep 2024 06:08: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 1snu37-007PCe-LB for pgsql-general@arkaria.postgresql.org; Tue, 10 Sep 2024 06:08:25 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1snu37-007PCW-A2 for pgsql-general@lists.postgresql.org; Tue, 10 Sep 2024 06:08:25 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1snu34-000Q12-LR for pgsql-general@lists.postgresql.org; Tue, 10 Sep 2024 06:08: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 48A68IGF3362838; Tue, 10 Sep 2024 02:08:18 -0400 From: Tom Lane To: Ahmed Ibrahim cc: pgsql-general@lists.postgresql.org Subject: Re: Check used privilege in a statment In-reply-to: References: Comments: In-reply-to Ahmed Ibrahim message dated "Mon, 09 Sep 2024 21:22:25 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3362836.1725948498.1@sss.pgh.pa.us> Date: Tue, 10 Sep 2024 02:08:18 -0400 Message-ID: <3362837.1725948498@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Ahmed Ibrahim writes: > I am trying to know which privileges are used in a specific query but I am > facing problems when I have nested queries. Where is the best place/hook I > can check for all needed permissions for a query in the source? Currently, > trying it in the exectuter start but the nested queries are problematic. Nested queries are irrelevant, because the query is flat (or at least the rangetable is) by the time it gets to the executor. See ExecCheckPermissions. regards, tom lane