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 1sskoA-00AemF-QE for pgsql-general@arkaria.postgresql.org; Mon, 23 Sep 2024 15:17:03 +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 1sskoA-00AyLy-3I for pgsql-general@arkaria.postgresql.org; Mon, 23 Sep 2024 15:17:02 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ssko9-00AyLe-5O for pgsql-general@lists.postgresql.org; Mon, 23 Sep 2024 15:17:01 +0000 Received: from fout-a7-smtp.messagingengine.com ([103.168.172.150]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ssko4-000geJ-4O for pgsql-general@postgresql.org; Mon, 23 Sep 2024 15:17:00 +0000 Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfout.phl.internal (Postfix) with ESMTP id 88E2C13802A6; Mon, 23 Sep 2024 11:16:55 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-11.internal (MEProxy); Mon, 23 Sep 2024 11:16:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1727104615; x=1727191015; bh=IsVUSoThTlw/1mP3KrMHlCBdOoEs/b8nk0f4j5gKxaU=; b= OBVE2xAPImjHa+boCETqhkHQx43WyUD3ppvnACIGgHxRKSawoaYC5uOM2IZWJS6U 8LSXzF8eZGlVp3S7pvw4lEJDt1ZhtcbVa12fuDRXyfszLMc3wSsRA1pjtdwlsifV pDjM/1KBX4LEhf5gIwE5qy8IlRzEXtwJzStraFEtOKALc52TPyPLdKHDWdVV44Gy jXX6bmw3Vo4vbrT3+iRFG6rpq7iUT9YQhs4CDe9sYqURalgdEZ9UwDEsRYuDrl7e LAka0i33DetGozvRCbhvxHcA2RxR3xjcMBz0Zrd6mDA9n0XDbPmFSWHgC1/AoPkZ lPk6DzWpQitQFBcnqNk3EA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1727104615; x= 1727191015; bh=IsVUSoThTlw/1mP3KrMHlCBdOoEs/b8nk0f4j5gKxaU=; b=o CWtZlD1XuMy8xDJDf6P7vwFASxTj3tulwv6peCC+6thtBTVp1TQKYC+Konx0HZl6 pePhrJ316vXyhjhKJB9O9g+HtapdF7NbavdUESwmFA5MKFAJ6dioyjftLxazSSGt 0Pqya3LLlzIpF8Q5ORksWiaC2peCQOw7THEwHgzr/cIwzeHc7G0wtyB92vGfVojJ OUGQoSjNsSn+qvR1BCuFtRPcTBcISY1NR4GvlwTJ1VuqgYMGre+EPX/wKkPaOsVt y9mNSwrZ0IU9HbjoZzkQofwMuctJphnnEOxths0CgbW1CZewMsnE+vq1Vikrpdxr 3Kny04tt0Dmra2i0GaiHA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrudelledgkeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddtvdej necuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrh esrghklhgrvhgvrhdrtghomheqnecuggftrfgrthhtvghrnhepgfdufeekhfevfeelveei ueevhedvuddukeduvddvlefhueeuieejtdeuvdevvdeunecuffhomhgrihhnpehpohhsth hgrhgvshhqlhdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgr ihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmpdhnsg gprhgtphhtthhopeeipdhmohguvgepshhmthhpohhuthdprhgtphhtthhopeguuggvvhhi vghnnhgvsehgmhgrihhlrdgtohhmpdhrtghpthhtohepthhglhesshhsshdrphhghhdrph grrdhushdprhgtphhtthhopehlrghurhgvnhiirdgrlhgsvgestgihsggvrhhtvggtrdgr thdprhgtphhtthhopegvfihivgesvgifihgvrdhnrghmvgdprhgtphhtthhopegrshgrug grlhhinhgrghhrihesghhmrghilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhgvghn vghrrghlsehpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 23 Sep 2024 11:16:54 -0400 (EDT) Message-ID: Date: Mon, 23 Sep 2024 08:16:53 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Customize psql prompt to show current_role To: Dominique Devienne , Tom Lane Cc: Laurenz Albe , Erik Wienhold , Asad Ali , pgsql-general@postgresql.org References: <3079980.1727103295@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 9/23/24 08:07, Dominique Devienne wrote: > On Mon, Sep 23, 2024 at 4:55 PM Tom Lane wrote: >> Laurenz Albe writes: >>> To get the current role, psql would have to query the database whenever >>> it displays the prompt. That would be rather expensive... >> >> See previous discussion: >> https://www.postgresql.org/message-id/flat/CAFj8pRBFU-WzzQhNrwRHn67N0Ug8a9-0-9BOo69PPtcHiBDQMA%40mail.gmail.com >> >> At the time I didn't like the idea too much, but now that we've seen >> a second independent request, maybe our opinion of its value should >> go up a notch. > > Thanks for the reference Tom. I don't follow -hackers, so missed it. > > Obviously I disagree with your "it's not useful enough" comment :) > > I often lose track of which ROLE is active, in my many > long-lived psql sessions, on various servers (mainly v14 and v16 these days), > especially during my recent struggle to adapt our system to v16. > I often resort to \conninfo, but it's less automatic and > harder to visually parse (IMHO) compared to a custom ad-hoc prompt. For me that shows the user that connected(session_user) not the current_user. > > Therefore I want to respectfully re-iterate my interest in this enhancement. > > Thanks, --DD > > -- Adrian Klaver adrian.klaver@aklaver.com