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 1ssifb-00AO0N-EM for pgsql-general@arkaria.postgresql.org; Mon, 23 Sep 2024 13:00:04 +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 1ssifa-008UPW-Gt for pgsql-general@arkaria.postgresql.org; Mon, 23 Sep 2024 13:00: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 1ssifa-008UNQ-5d for pgsql-general@lists.postgresql.org; Mon, 23 Sep 2024 13:00:02 +0000 Received: from mail-oo1-xc2d.google.com ([2607:f8b0:4864:20::c2d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1ssifU-000eCo-1n for pgsql-general@postgresql.org; Mon, 23 Sep 2024 13:00:00 +0000 Received: by mail-oo1-xc2d.google.com with SMTP id 006d021491bc7-5dc93fa5639so2215952eaf.1 for ; Mon, 23 Sep 2024 05:59:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727096395; x=1727701195; 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=1goeL2YwFvsQTFghsuqZHfO2KOShZCMVCNzRj9WwDyE=; b=OCLNRy+V4/yCEOiTOcphVGZ78JNh5hnxwVocNyiBHlBYTh5Epf1+IDqlhMYYa9TvfU APuZLg95yGzoGbUEYlZ3/bHn2uIwXfTN0PPyienOKf6lz6VrR1mW9Pzect/OQIkFB4hr BcOtJyCN3DcDCe/XQPu2NwhpdzAiHmoLjrUGChuR6dYQ8agwOuWaLYJrXSH0LP1AiU24 ZxKkvwSCd4wJY9lHezh36JyXgBk1k3Dob0+rWUjH2wpLEqwzdte1I2uilKnhZVvrgMpi 5ZnBqx0yIPHwv27CwOfa2pA4X+IHUNB6R6SwZROrPSKUz0Dq+ezwBMcuwkqI5OMaVVIB QRcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727096395; x=1727701195; 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=1goeL2YwFvsQTFghsuqZHfO2KOShZCMVCNzRj9WwDyE=; b=Jghp0W3BfHQL5ZWPrXzquGel9sJImQOHT/H0q1eV8WUnBHk/EytsW67PSsMYa39/F0 X2mZ1M5EG40Aj6L+vH6NnwqduLZOkgUvcTOTEtlnPzArIMAt05UVd/cFEycNSdWeTX7S SN8nUbgfsxO+to43CwZXRgFrmGiSrb8d8hXLzJUJgiGnEa7B8biXo5sSI5oNDHys8Y4u 9+Ma8UzW/oK9PALi95B3/QiQp7p3Tsjgd0LW/FAyEn76jF9Fzkjp6MTbJ+4Pz5yb+dIf yWfL+nmnga6rbpGZgdwm2MuD6MMEgZ3OUXehIJt3NvxupPRA6bM1xB1rQVap2cdT1ptf JP4w== X-Forwarded-Encrypted: i=1; AJvYcCURl2Qp1EIiYgO6ohzKbH1A8+RlI21DMxWY5zGKxlSKwq72Ys3gJ4J/UV1MaIWt4bLBoAJDsLDRpXARTWPB@postgresql.org X-Gm-Message-State: AOJu0Yw75+D8nCOsxlqj8nHZClAc2Uc+Q6ZP/Fj1N1VrA8VSbKUz6VVD fO2DxnqEAJlIcBasHgojlK6d2aYF+PCcMnkRftT7Fre2PsStVxLlpH/wdXhgaXxR4DGWIadGzQ8 0I96j85Idcwifuh0uK4eh5AFe3SM= X-Google-Smtp-Source: AGHT+IFef/7Uen5WZlZ32g1N3LOWnPQ3fIT0mKVh/sTnx12sAynVGgC4y5ItQ1q5bWAYs1ekuVgsG9v0uIWONBnikcw= X-Received: by 2002:a05:6820:210:b0:5e3:b6f9:1f8e with SMTP id 006d021491bc7-5e58ba5ceb5mr5797641eaf.3.1727096395387; Mon, 23 Sep 2024 05:59:55 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Dominique Devienne Date: Mon, 23 Sep 2024 14:59:43 +0200 Message-ID: Subject: Re: Customize psql prompt to show current_role To: Erik Wienhold Cc: 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 2:51=E2=80=AFPM Erik Wienhold wrot= e: > You could instead use this: > > SELECT current_role \gset > \set PROMPT1 '%n@%/ (%:current_role:)=3D%# ' > > But that won't work with subsequent SET ROLE commands. Bummer... That was kinda the point, that it updates automatically. Then I'd like to respectfully request a small enhancement to psql to support a new \r (or some other letter) for current_role in the prompt. Thanks, --DD