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 1mdbsT-0003tf-J2 for pgsql-general@arkaria.postgresql.org; Thu, 21 Oct 2021 17:29:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mdbsS-0004J7-HZ for pgsql-general@arkaria.postgresql.org; Thu, 21 Oct 2021 17:29:16 +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 1mdbsQ-0004I0-JW for pgsql-general@lists.postgresql.org; Thu, 21 Oct 2021 17:29:16 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mdbsN-000089-JH for pgsql-general@lists.postgresql.org; Thu, 21 Oct 2021 17:29:13 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 0B05F32009EF; Thu, 21 Oct 2021 13:29:09 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 21 Oct 2021 13:29:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= message-id:date:mime-version:subject:to:cc:references:from :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=D pQRaENtsZFhl7P/59RhU0O2oFnfeeXotkN7lhif0pQ=; b=Pj+V1gkylzYpNbVCX vqFWMqSOBd3OREPX373FQoBHc98OUCQE1hDPBvr2QnQx/waFiFkA6JhfTmrlhTV5 FCGTU2A2KR6w+Wn7zdfW2pYGuLBT45LJxq97D7mAh3Htgi/TEx/aYLb7sC/oNqmK voPYZUPkHPq+fsd/8CIWzxqkoTCDxCjBeV/swnPAWeRAg8tTbTJPjf8dvqsLQFnu ACjuZ1g9RdknuRuv5VhxwmOnQh5+t2RnI1vbqWysMaT6yYUpg7nSo2PVL5hdlGmA duBh4a4Mes3gNsyhVK0W9Iu4s0ToYbNvnjdLj7ZGPNLYVn1QWvn2sxG9Bgq5eBpn ltpCw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=DpQRaENtsZFhl7P/59RhU0O2oFnfeeXotkN7lhif0 pQ=; b=jBY1vzdfY80gz7H7g3MNucb4Uk0MICyj3oqL6F2ab8l7kn0SuvyPfiVFv axJUWvRp7r6fezc9tp0Y/h/NMLJJHJ4IbpvvoYOd1KZ8uN54YCnA1b6jjXWUUVGV GOzCAOobOybfJPuqbcnOQn5/PDigS7vps8dL5l6HBQN5Mk2C4No+vav6pLjNwB4Q i77MR3K5hhCucazbGrWx4UkcDcSKXLxPe0ruOLlM79GornGtb+aX8dqy1iVToIt6 DJGv/N2hAHn/JFCQwtodrwoG7Yt/VujbzSqnrZm4wlhZktmE0atIb4oezjcQuKfK 9XaPcV38w0CK+4N+v+8ADYpGkoklg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddviedgudduvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepkfffgggfuffvfhfhjggtgfesth ejredttdefjeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdr khhlrghvvghrsegrkhhlrghvvghrrdgtohhmqeenucggtffrrghtthgvrhhnpeevvdekie fhudfhhfdtkeelgeffudeigfetjeegfffghfetfeelledugfelleegveenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrg hvvghrsegrkhhlrghvvghrrdgtohhm X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 21 Oct 2021 13:29:08 -0400 (EDT) Message-ID: Date: Thu, 21 Oct 2021 10:29:08 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: Can db user change own password? Content-Language: en-US To: Tom Lane Cc: Toomas , Vijaykumar Jain , pgsql-general References: <62f56a19-0504-4d7b-5f73-b10e8206642a@aklaver.com> <7FC82398-5C8C-4F2D-9620-D16E54E77091@gmail.com> <2424680.1634835237@sss.pgh.pa.us> From: Adrian Klaver In-Reply-To: <2424680.1634835237@sss.pgh.pa.us> 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 10/21/21 09:53, Tom Lane wrote: > Adrian Klaver writes: > It's fairly obvious what's happening here: psql sends ALTER USER xxx > PASSWORD ..., where it gets xxx from PQuser(), so that is the role name > that was logged in with. There are any number of reasons why that might > not be the currently active role. > > The psql man page says > > \password [ username ] > Changes the password of the specified user (by default, the > current user). > > So I'd say this is not doing what the documentation says. Oops. That is where I got hung up. > > With server versions >= 9.5 we could dodge the issue by sending > ALTER USER CURRENT_USER PASSWORD .... For older servers, > I suppose we could do "SELECT CURRENT_USER" first. > > I'm not sure if we want to change a security-relevant behavior > in released branches. But if we don't, we probably need to > change the docs to something like "(by default, the logged-in > user)". I would suggest session(_)user to make it match with the rest of documentation. > > regards, tom lane > -- Adrian Klaver adrian.klaver@aklaver.com