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 1tGIoB-0026uJ-P8 for pgsql-general@arkaria.postgresql.org; Wed, 27 Nov 2024 14:14:23 +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 1tGIoA-00F6Rq-48 for pgsql-general@arkaria.postgresql.org; Wed, 27 Nov 2024 14:14:22 +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 1tGIo9-00F6Rf-O7 for pgsql-general@lists.postgresql.org; Wed, 27 Nov 2024 14:14:21 +0000 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tGIo6-004AXh-L9 for pgsql-general@postgresql.org; Wed, 27 Nov 2024 14:14:20 +0000 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-5cfd3a7e377so8735222a12.2 for ; Wed, 27 Nov 2024 06:14:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1732716857; x=1733321657; darn=postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=FTeQ/DyXHMO3odFErpbh50t45BfGMoj9fSnq5hKNpok=; b=JTSdXwIFz1VtmTmUUCnT5FbBXLEQVRAtfImX/3pkQmPOqwz0TaE/Bhxyw0dgKXbFXp hNF37CVSvXFHb0xRD0HQxTjzBRfK9v7OW+z1+5iOAv53bufUhfklnfUqLrjXOgqeug9g QtfwAv7eRPFvSyc5CoS8IpeWGIrVZ9u8/R5C7sa8lT09IY51dWSEef+1vB2nawbfGRf6 7GtOBgr5MhA/emme5+zQ0ZqLBFC//HHHEUAL0P9ZFYRu+bkNez68L1uEGV0zdzgebdP3 tkAovDXVmK+I7kRLpgCf+GqWNz7mGkmPKDwSBSXDTHgdG2wNHRWlucpM6BSZEdA2jwpP eJtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732716857; x=1733321657; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FTeQ/DyXHMO3odFErpbh50t45BfGMoj9fSnq5hKNpok=; b=RlACFQPmJzxYgLYe/sv5bbGjkMxiN4SVcoZXx7OxhbRoAmFq3UpiVEnr9Tndh94DcY ZHciaPZdRcatoYYEUtDIouFloYnC1vNAIjunTy1I2+E/htN8BUlkdUWxk7yjmEcwD/6r PnQUVWWn41A+i4D2H0j5r4s6ueC2gAk0M4UtLE34tuCN3WA2OpdKNK5NXr1amWigd+SS WvBB7mwd+pzZH/X+Wk9TT7nom9HhzsAnndncyozR80K4RdSLsPiq++5FN8jPJXp8o0LA 6bcP6C//GLm9xvDhDZb8yFVmePSfiaHAuAEIggmYuNGSaCNUnRnAYwHm2TiWzhYh2JCg JKNQ== X-Forwarded-Encrypted: i=1; AJvYcCWfM/evgjESh08gjp+rv1QBJO7hJKxKVPo5FhaOIQUOUSB+yU9LnBJOOMbivJRnJF3wjnAy0XUaDfSI4Tha@postgresql.org X-Gm-Message-State: AOJu0YzQXKiauWa+QLemIWqxMzz+RK1iARdtjmTHEacfRmoWPR4i99mc SRMbdrJh3kO8Gl58MYhtxPjFsSylEaHd+eK9v+AxA6OcpnyJFmOrmrzbCgj1eQ== X-Gm-Gg: ASbGnctKSODbpDFk50jcH1Rh7RrOLYsYw503B3zNPT399+uM43PTO5t+LVKhCleWwg1 cDTV56bJ4IeE7zMNkwDtkegVkroqU4I2L70fqQSZX7LTaKOJK6jOJh1Y3YD84aDqlXX7fEYaQAA efyId2BLkxz3njNwSb9cy097HGUZM4ObejEhxfnnCXLeUsjOTaCcB2cEa+2GheayhWvKWGIwZDz pv4WDX+kQs6AYrdpYy/mlNRZqjPKWgbdAe5caeUed0Sr8tWluQ/DrtQ9RPsRJDX0/6n+Qjdy3kD aCGFQ4ScRhEoXL7awqi4SgST1Z6hPA== X-Google-Smtp-Source: AGHT+IE69wPOxSeVVPZceJpYBpl94WLncpYDfpr8g2DIkOuRkWaXB3s05+Y+lfVvv3VRIQdQfNU4pg== X-Received: by 2002:a05:6402:4010:b0:5cf:cf81:c3a2 with SMTP id 4fb4d7f45d1cf-5d080c4aff1mr2958247a12.25.1732716856829; Wed, 27 Nov 2024 06:14:16 -0800 (PST) Received: from smtpclient.apple (i68975A52.versanet.de. [104.151.90.82]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5d01d3a3bfdsm6142418a12.5.2024.11.27.06.14.15 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Nov 2024 06:14:15 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51.11.1\)) Subject: Re: Customize psql prompt to show current_role From: =?utf-8?Q?Raphael_Salguero_Arag=C3=B3n?= In-Reply-To: Date: Wed, 27 Nov 2024 15:14:04 +0100 Cc: Adrian Klaver , Laurenz Albe , Erik Wienhold , Asad Ali , pgsql-general@postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <3079980.1727103295@sss.pgh.pa.us> To: Dominique Devienne , Tom Lane X-Mailer: Apple Mail (2.3776.700.51.11.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Am 23.09.2024 um 17:37 schrieb Dominique Devienne : >=20 > On Mon, Sep 23, 2024 at 5:16=E2=80=AFPM Adrian Klaver = wrote: >> On 9/23/24 08:07, Dominique Devienne wrote: >>> I often resort to \conninfo, but it's less automatic and >>> harder to visually parse (IMHO) compared to a custom ad-hoc prompt. >=20 >> For me that shows the user that connected(session_user) not the = current_user. >=20 > yeah, sure, I realized that just after sending my last post... > I resort to using both \conninfo *and* `select current_role`. > I used \conninfo to tell me which server I'm on (since not > on the default prompt, before I played with it today), which > session_user I'm connected with (ddevienne or dd_login > in my recent example), and finally `select current_role` > which matters in my use-cases (session_user or dd_admin or dd_user). >=20 > I'd like not to have to type those commands/queries all the time, > and have them in the prompt at all time. I get that it's not for = everyone, > nor even necessary all the time, but I sincerely think it is = definitely useful. >=20 > I'd be glad to use Pavel's proposed %N. =E2=80=94DD >=20 Hi all, I just wanted to add that we are also supporting a larger customer with = exactly the same request. Perhaps this increases the value of the adjustment a little more :) Best regards! Raphael Salguero=