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 1ow8Xr-0001eh-Lg for pgsql-general@arkaria.postgresql.org; Fri, 18 Nov 2022 21:05:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ow8Xq-0001hY-GZ for pgsql-general@arkaria.postgresql.org; Fri, 18 Nov 2022 21:05:06 +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 1ow8Xo-0001ZM-1f for pgsql-general@lists.postgresql.org; Fri, 18 Nov 2022 21:05:06 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ow8Xk-0006EU-HQ for pgsql-general@lists.postgresql.org; Fri, 18 Nov 2022 21:05:03 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 3B1943200ACF; Fri, 18 Nov 2022 16:04:55 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Fri, 18 Nov 2022 16:04:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1668805494; x= 1668891894; bh=vt2QUDPkO9xFh0Xl2XHWzuwxPD5rTnPPyIY8+LCeUT8=; b=5 Jr7UbvoAhX3rtscuQv68HFtoxAti8uIabhDh4jHioK5VoKGBOmVF+tAK53Ph9E1z 8yU0mT971I5Y/Mh14JZzrX5XsEOKnYCZFkhrZQzOxKcwI307RmnEu44jZjad2aes mfejLz9FYZSGwnvh43d1HIxr1X5QnIDgOr6x/3univVJg3SBCzUs/cg5xLmdxaYy hA1nOuoiVk1bvLcP6aF91cjtZLt2J3NuUMYN3Fjk8NbENZHOwU2HdKK9V3jmjfvu TE8XNHxNflQkeydhfsOT8ZOVB3wr1sm3P8fCJRNP5WZl9Tf9D2gxEwXkAXhAZII+ eKkNL4vhXQ5ANz9z7+5mw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1668805494; x= 1668891894; bh=vt2QUDPkO9xFh0Xl2XHWzuwxPD5rTnPPyIY8+LCeUT8=; b=b +ak6/VzjMwbj3TILgyrFOLpuyKuckv6kIaId1VTH24JeHyemEtpvHvbolsedSf2j qvGGrKDFioJCdxhLQHr+19EsqYcPxAj1M4q3etTEJRGPD07SHabPkm5ucQHU83Qy gDJn1CD9LKP92o0+c+9Rfb49RVrARQab5AJBzNI5tAxiWQnPKTy+3/vor4u0snE9 dLA+x3LJEjxnGsi4y+nlQuv2iKP97Mbnp4X82zUexbBmNycTBvffw0D7DwZ1V/K0 R1ALm48+1dOEXF/1KZ92W2w1nIWiIpR9MEs7aeL5mzVfnneIbxhRK7gx/czz0H9x 08kTd4NmO/cKCtCQ0W9gg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrhedtgddugeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddtfeejnecuhfhrohhmpeetughr ihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtg homheqnecuggftrfgrthhtvghrnhephedugfethfettdehieevteeukedtjedvhfevkefg udefgeevteduvdeuvdeggeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 18 Nov 2022 16:04:52 -0500 (EST) Message-ID: Date: Fri, 18 Nov 2022 13:04:49 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: RES: RES: session_user different from current_user after normal login To: Murillo corvino rocha , Tom Lane Cc: "pgsql-general@lists.postgresql.org" References: <359ae842-c217-1055-e24b-173918c1e5f3@aklaver.com> <2184327.1668781907@sss.pgh.pa.us> Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 11/18/22 12:52, Murillo corvino rocha wrote: > Could it be the role=group_read_only? The fact that user1 is a member of > group_read_only is changing current_user variable? Well role=group_read_only means this: psql -d database -h host -U user1 effectively becomes: psql -d database -h host -U user1 log in as user1 then SET ROLE group_read_only; which results in session_user: user1 current_user: group_read_only. user_1 being a member of group_read_only does not automatically change the current_user to group_read_only. This happened because it was explicitly set up do this. > > I’m using a clean psql docker container everytime I need to connect to > the database, so, I don’t think it’s related to psql. > > \drds > >                     List of settings > >    Role        | Database |             Settings > > --------------+--------------+----------------------------------- > > user1        | mydb       | role=group_read_only > -- Adrian Klaver adrian.klaver@aklaver.com