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 1sskSy-00AcFu-Hc for pgsql-general@arkaria.postgresql.org; Mon, 23 Sep 2024 14:55:09 +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 1sskSx-00AaNk-Tg for pgsql-general@arkaria.postgresql.org; Mon, 23 Sep 2024 14:55:07 +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 1sskSx-00AaNb-Im for pgsql-general@lists.postgresql.org; Mon, 23 Sep 2024 14:55:07 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sskSt-000gV6-3o for pgsql-general@postgresql.org; Mon, 23 Sep 2024 14:55:06 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 48NEstFT3079981; Mon, 23 Sep 2024 10:54:56 -0400 From: Tom Lane To: Laurenz Albe cc: Dominique Devienne , Erik Wienhold , Asad Ali , pgsql-general@postgresql.org Subject: Re: Customize psql prompt to show current_role In-reply-to: References: Comments: In-reply-to Laurenz Albe message dated "Mon, 23 Sep 2024 15:05:10 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3079979.1727103295.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 23 Sep 2024 10:54:55 -0400 Message-ID: <3079980.1727103295@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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. regards, tom lane