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 1pjJmG-0001zq-He for pgsql-general@arkaria.postgresql.org; Mon, 03 Apr 2023 12:59:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pjJmE-0007mN-Lv for pgsql-general@arkaria.postgresql.org; Mon, 03 Apr 2023 12:59: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 1pjJmE-0007mC-BA for pgsql-general@lists.postgresql.org; Mon, 03 Apr 2023 12:59:14 +0000 Received: from smtp.burggraben.net ([2a01:4f8:140:510a::3]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pjJm7-0003ez-8n for pgsql-general@lists.postgresql.org; Mon, 03 Apr 2023 12:59:13 +0000 Received: from squirrel.exwg.net (p54933e3d.dip0.t-ipconnect.de [84.147.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "squirrel.exwg.net", Issuer "R3" (not verified)) by smtp.burggraben.net (Postfix) with ESMTPS id 14FCAC0031A; Mon, 3 Apr 2023 14:59:04 +0200 (CEST) Received: by squirrel.exwg.net (Postfix, from userid 1000) id BC3124B382; Mon, 3 Apr 2023 14:59:03 +0200 (CEST) Date: Mon, 3 Apr 2023 14:59:03 +0200 From: Christoph Moench-Tegeder To: Dominique Devienne Cc: pgsql-general@lists.postgresql.org Subject: Re: DEFINER / INVOKER conundrum Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/2.0.5 (2021-01-21) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ## Dominique Devienne (ddevienne@gmail.com): > On the one hand, I want a INVOKER security function, > to be able to capture the login and current ROLEs. There's session_user ("the session user's name") which remains unchanged on a SECURITY DEFINER function, and current_user ("the user name of the current execution context") which changes according to the security context set by SECURITY DEFINER/INVOKER. -> https://www.postgresql.org/docs/current/functions-info.html Regards, Christoph -- Spare Space.