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 1sskfV-00Adut-J3 for pgsql-general@arkaria.postgresql.org; Mon, 23 Sep 2024 15:08:06 +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 1sskfS-00AlfA-SO for pgsql-general@arkaria.postgresql.org; Mon, 23 Sep 2024 15:08:02 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sskfS-00Alf2-Fn for pgsql-general@lists.postgresql.org; Mon, 23 Sep 2024 15:08:02 +0000 Received: from mail-oo1-xc36.google.com ([2607:f8b0:4864:20::c36]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sskfP-000fHD-RL for pgsql-general@postgresql.org; Mon, 23 Sep 2024 15:08:01 +0000 Received: by mail-oo1-xc36.google.com with SMTP id 006d021491bc7-5e5b57127e6so175819eaf.2 for ; Mon, 23 Sep 2024 08:07:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727104079; x=1727708879; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Z2pB4z6E76qkMyf+VY78ClJHC7OXbfQSM2ZmxFp/wOs=; b=NhrBzenhIA0dOktYWsa0jsLkGR57V/dx2dSkBgoUHFOHocNKNtmvto6bArJVy2mRt1 O4saQHlUyNryLywpQPSf48xEy+EEJk8fJX31Wb2juiviTf4oQ0EjW4DZGMi4TaDHGMsM 4bHal/7FoKNO4B/PDQ0bI2A2SHItmg3MXhaYDNOl+u4h8G7TRfPqlubgWTinKfv0NGg1 rpVV2lILBEtYb8EJMCzcH9Ekk1nOz1tr0ot2YAefpfPKswhecvZTYINTOCWqPjTftwj2 0sKwmWGQ2Y3dETV8Pjo6ckDjAND1rsx2joTeGSJyDHN4Cp4w0NvzECIo+wZXyO5FSDjZ q1CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727104079; x=1727708879; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z2pB4z6E76qkMyf+VY78ClJHC7OXbfQSM2ZmxFp/wOs=; b=d4vKwq9VWvppEKW7cpVqV3QW9cWJMjQVmAG7NrZfM5ncEODcrcfYKvC7wMbLzIA/Q6 YcZJNCTmqh8BWgj73QzYQS7NxHbPQbuFz/ayvearQ2FwPxnZl+A1GRLQfjrFbncwQFo/ OmaMukwQFMPHMnFMlyY3wMQrTfISZo8CTRQVB4mBdTYRAn3nN2bp9ZEp8mny7YFfmGY7 531iQZOhRIP0ToC2WaYGMe5lEO1Gl3S+uidLitg1FKIS/wE/vTDcD680Oi6rg8c6ux3k yA9H38k9Dhf+Xmd3hmztYAiKpFowUyOEMZdzcdkitegX/dPblpbqnC96SJprhZIct6Ry olOQ== X-Forwarded-Encrypted: i=1; AJvYcCUmN+Uh+F2mQq+9Ol2tn4538UtT/K7x472bgJxee7KkTYeTXhXYMvKvufgyILOn2Audpi6trgf3ng+KoF87@postgresql.org X-Gm-Message-State: AOJu0YzVck5DIjT22Jda4VtT09uFHP+C1/jsAYD4YmK45WR/XVnRVZOi 5Zz2NaqxUgrAHHhh42gx2L+HMgar8QHCK+lsXOwi2pRxLsrT08bZ94yvPNPg+cIoigQAwM1YR23 lmdOjLtYYPJa2QDwW1A9X7hErew0= X-Google-Smtp-Source: AGHT+IEUl/qJAWhw6x1VVfKRgWAl4AMCKRF10kKcSJGMdSmxX6+sH3SJCC6Hv8OAcGGwoGa6vH/l0bRgAB2E5J3fDBw= X-Received: by 2002:a05:6820:16a9:b0:5d5:bce7:677 with SMTP id 006d021491bc7-5e58ba9aceemr5309929eaf.7.1727104079081; Mon, 23 Sep 2024 08:07:59 -0700 (PDT) MIME-Version: 1.0 References: <3079980.1727103295@sss.pgh.pa.us> In-Reply-To: <3079980.1727103295@sss.pgh.pa.us> From: Dominique Devienne Date: Mon, 23 Sep 2024 17:07:47 +0200 Message-ID: Subject: Re: Customize psql prompt to show current_role To: Tom Lane Cc: Laurenz Albe , Erik Wienhold , Asad Ali , pgsql-general@postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Sep 23, 2024 at 4:55=E2=80=AFPM 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-WzzQhNrwRHn67N0Ug8a= 9-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. Therefore I want to respectfully re-iterate my interest in this enhancement= . Thanks, --DD