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 1ssij4-00AOx1-I6 for pgsql-general@arkaria.postgresql.org; Mon, 23 Sep 2024 13:03:39 +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 1ssij3-008dwO-US for pgsql-general@arkaria.postgresql.org; Mon, 23 Sep 2024 13:03:37 +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 1ssij3-008dwF-Ji for pgsql-general@lists.postgresql.org; Mon, 23 Sep 2024 13:03:37 +0000 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1ssij1-000eEx-6j for pgsql-general@postgresql.org; Mon, 23 Sep 2024 13:03:36 +0000 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-535dc4ec181so4198916e87.3 for ; Mon, 23 Sep 2024 06:03:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727096614; x=1727701414; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=5t+fK7gNUrivfo/5yJWFrYvjQejeByjvgqykTKVFFS4=; b=lCmrYhmxkg+JIFrTho/BKboXxh/gyu5P7Ba2bugLBQFYDQWAm0ryOZ2YE0gfICqwNO 1nMq+r9Rah2haIL0s8wm2P+gVg85NSi02v89FO9oGN76G61HeZ00dSJX6Xfppp9FLjBi dek6dpnNLgB0kni8TUTh9BoF3WACQU3p/yjfo0tC7WQKV2Do3jTktz0197dNeR5zfO8G f96510r9GcpHNvcyvAX1GUOaf/K4Kw1IR0l8maYgwuPjARgzO2YVFRz2otnFkNLzqMio ziupH/Tgx15U9LTNCpS5S9BpBG/GCO4IYiLLFsx0Ut34Hu0PUax9bUfXZqYYkmSOAMhw Rexg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727096614; x=1727701414; h=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=5t+fK7gNUrivfo/5yJWFrYvjQejeByjvgqykTKVFFS4=; b=kxhoQNeRs9sJs5Fzbl2Cu9/vEvq7ksteLu6rNtX0xl/Ds0dB1sgd12Wa0SoU4uga+j m3igvaFXse6AFiCnm15C+rpP1YUyBfGs8PrUST1FWNT26rksBfXVnQfATB6EL2ejzLTB EcmwFWualKRqQCbQcb6bwPEt7L0Lf7IWRrJljwjKNj6ayVZTsGSpe4lKCH10PsIyKWzm R5lC7yOYWepgPa/VBFMEmrxFgpbuK8Tk4Gr/h/quGFFxaK5baSs1uhgathxLLCjxn/dz HmK5GmMuBtVrDmcDf5wmxGAMcI0yIOgl8NUgADepR0Y6ZdLyLfyHU6tw4wh+FmyFJPTr UEKw== X-Forwarded-Encrypted: i=1; AJvYcCVl2tKMv108LOisvvDS2Y9D3v+ZJuTjdV2YmuLBF8QWR4XQexX2fi/GDib+0j374JvSdrG4bPeO3KEKyfH8@postgresql.org X-Gm-Message-State: AOJu0YwgVRD0+cLQnDDIS6bJNcn9huqr1Cv6usU5efiYcNhohZuXAZdH t5NSh7t1ArO4Z7k1kwEjcJWlmY5TvKSe+lcKrOBfGJZI+ukO9SPKwaB+BoFJqQIr0aV3H6V96+J Iy6pmAOSWRJJ1dnTWtGQSkF+1ynM= X-Google-Smtp-Source: AGHT+IEkf2F1AzcHjhBkAZYbaabN+0ppKA7K2lNJsllWsHSNRFgbc79CjHMlM+8kAbI7srGE2NORPk3xbfXFr9+wmvQ= X-Received: by 2002:a05:6512:4025:b0:536:14a1:d660 with SMTP id 2adb3069b0e04-536acf6ace8mr6025527e87.6.1727096613254; Mon, 23 Sep 2024 06:03:33 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Greg Sabino Mullane Date: Mon, 23 Sep 2024 09:02:57 -0400 Message-ID: Subject: Re: Customize psql prompt to show current_role To: Asad Ali Cc: Dominique Devienne , pgsql-general@postgresql.org Content-Type: multipart/alternative; boundary="000000000000203d050622c9045b" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000203d050622c9045b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Sep 23, 2024 at 8:22=E2=80=AFAM Asad Ali w= rote: > There is no direct prompt escape sequence like %n for displaying the > current_role in the psql prompt. However, you can work around this by usi= ng > a \set command to define a custom prompt that includes the result of > current_role. > Please do not use chatgpt or other LLMs to answer questions on this mailing list! If you had even done the bare minimum of trying your own lazily-generated answer, you would have found it did not work. Greg --000000000000203d050622c9045b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Mon, Sep 23, 2024 at 8:22=E2=80=AFAM A= sad Ali <asadalinagri@gmail.co= m> wrote:
There is no direct prompt= escape sequence like %n for displaying the current_role in the psql prompt= . However, you can work around this by using a \set command to define a cus= tom prompt that includes the result of current_role.

Please do not use chatgpt=C2=A0or other LLMs to a= nswer questions on this mailing list! If you had even done the bare minimum= of trying your own lazily-generated answer, you would have found it did no= t work.

Greg

--000000000000203d050622c9045b--