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 1oKLH7-0007iG-3x for pgsql-hackers@arkaria.postgresql.org; Sat, 06 Aug 2022 14:59:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oKLH4-0003p2-To for pgsql-hackers@arkaria.postgresql.org; Sat, 06 Aug 2022 14:59:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oKLH4-0003jU-Ac for pgsql-hackers@lists.postgresql.org; Sat, 06 Aug 2022 14:59:34 +0000 Received: from mail-vs1-xe29.google.com ([2607:f8b0:4864:20::e29]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oKLH1-0005RZ-UA for pgsql-hackers@postgresql.org; Sat, 06 Aug 2022 14:59:33 +0000 Received: by mail-vs1-xe29.google.com with SMTP id k129so5097466vsk.2 for ; Sat, 06 Aug 2022 07:59:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joeconway.com; s=google; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id:from:to:cc; bh=u8CYYdQKT5IwdqIzPNJ/xpxARCNfgiiSe/2l66Tiacc=; b=cDyZKSqtJBjQkjArdytZBXHdwL2gfgptQORl7LygqlMP5pBSeh7F3DMaSukVslRuFG tDMiYcAn0ccGKAv2YO85LDuQGA37eqLRjb57s6mDwy+8a3M6Hk5MH7GJTmDjiNCixm8D pBRJWATAkH/UnSbbSLUjl6sMwAjuzmk9rP4eaTF5SOuFPw0HDCbmAGgyshdoDT0LHrjC dwmjrleuiCpVOPNIrYrU5H2BVBJATnJW5wVsBHL1QeVGikLovQ4JrNHWkAuvihWZ6Tg4 rlpF0P4pWixL9QyFEPZiiGZBR8lqPET0V2dc3vTOjV1vlhjvvFyv2zjr/JlEgZF1HyqW fG6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=u8CYYdQKT5IwdqIzPNJ/xpxARCNfgiiSe/2l66Tiacc=; b=Eg+BwEvGmMbBTr+B094fdQuSgiQgsQTBMTUqGPmgTT2UMlOgcmEpsIS2VXkEwNk1ov a6g492EiCkeQoKO71zLfLlaPgmIDhG+yWQhdf1l4Xwqrvkvepjnxa0UjmvJdFEpHyscI CwdNjM/HP1+thGSgYjFXJSyR628G+DeJ5v5M9O9XAuY8gFAhgLj/jjqAOoCGnZ/DorpH jaegrBCq6Fs+vFvk0Zriz/UOEQ71jeznAjVeCK1Vr3CMtw2tQ80gOcbBSYwm0MNTRSK2 CVoqamIUyYMEmwsa8WAccL3wJf13M5pyDfNvfBtJ/0fKGP5kGHSeGc+u7uNiUgNDZp+u XpiQ== X-Gm-Message-State: ACgBeo153o96duZZcW3WJHLUwV3nybr/I2eulFBMWJNvXGIq78UNI7Ls PsA++azXL1R7QBEZkyhhrtM72A== X-Google-Smtp-Source: AA6agR6A9KWgDLGlxhXD3Z8JrqT68IsEuQdn9Kf/iVWlFb8xSbaN3VqAIDE8gUYRO5fEe15LtLWIOw== X-Received: by 2002:a67:b24b:0:b0:357:31a6:1767 with SMTP id s11-20020a67b24b000000b0035731a61767mr4806935vsh.29.1659797969644; Sat, 06 Aug 2022 07:59:29 -0700 (PDT) Received: from [192.168.4.41] (072-017-018-098.res.spectrum.com. [72.17.18.98]) by smtp.gmail.com with ESMTPSA id w20-20020ab06154000000b00382838cf25bsm5686986uan.35.2022.08.06.07.59.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 06 Aug 2022 07:59:28 -0700 (PDT) Message-ID: Date: Sat, 6 Aug 2022 10:59:26 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Content-Language: en-US To: Michael Paquier , "Drouvot, Bertrand" Cc: Jacob Champion , Robert Haas , Tom Lane , "sfrost@snowman.net" , "rjuju123@gmail.com" , "pgsql-hackers@postgresql.org" , "andres@anarazel.de" References: <200677.1654265052@sss.pgh.pa.us> <3b678314-054a-6119-b373-4574067f404e@timescale.com> From: Joe Conway Subject: Re: [PATCH] Expose port->authn_id to extensions and triggers In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 8/6/22 02:26, Michael Paquier wrote: > On Fri, Aug 05, 2022 at 12:48:33PM +0200, Drouvot, Bertrand wrote: >> On 8/2/22 11:57 PM, Jacob Champion wrote: >>> Thoughts from prior reviewers? Is SYSTEM_USER the way to go? > > Reading through the other thread, there is a clear parallel between > both in concept to provide this information at SQL level, indeed. > >> I did not look in detail to this thread, but if the goal is "only" to expose >> authn_id (as the subject describes) then it seems to me that SYSTEM_USER [1] >> is the way to go. >> >> [1]: https://commitfest.postgresql.org/39/3703/ > > However, I am not sure if the suggestion of auth_method:authn as > output generated by SYSTEM_USER would be correct according to the SQL > specification, either. The spec being not really talkative about the > details of what an external module should be opens up for a lot of > interpretation, something that both thread are dealing with. As I pointed out here [ https://www.postgresql.org/message-id/28b4a9ef-5103-f117-99e1-99ae5a86a6e8%40joeconway.com ] both the SQL Server and Oracle interpretations are similar to the one provided by Bertrand's patch: SQL Server: "If the current user is logged in to SQL Server by using Windows Authentication, SYSTEM_USER returns the Windows login identification name in the form: DOMAIN\user_login_name. However, if the current user is logged in to SQL Server by using SQL Server Authentication, SYSTEM_USER returns the SQL Server login identification name" Oracle: "SYSTEM_USER Returns the name of the current data store user as identified by the operating system." I am not sure how else we should interpret SYSTEM_USER -- if it isn't port->authn_id what else would you propose it should be? -- Joe Conway RDS Open Source Databases Amazon Web Services: https://aws.amazon.com