Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ivnDN-0006zv-VG for pgsql-hackers@arkaria.postgresql.org; Sun, 26 Jan 2020 19:04:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ivnDL-00009i-M7 for pgsql-hackers@arkaria.postgresql.org; Sun, 26 Jan 2020 19:04:55 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ivnDL-00009Z-8v for pgsql-hackers@lists.postgresql.org; Sun, 26 Jan 2020 19:04:55 +0000 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ivnDE-0005JP-9x for pgsql-hackers@postgresql.org; Sun, 26 Jan 2020 19:04:54 +0000 Received: by mail-wm1-x329.google.com with SMTP id c84so4604950wme.4 for ; Sun, 26 Jan 2020 11:04:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=uYBCEIavREY3lOTjzYq0/RHuyfWzkPb8jleZDn9aV5I=; b=QmB/EvRJbmDOTVF8nPJSLRxTevSvxwE57fX477tmc3fux0whH50h0rePaVWK6VNYA8 fNd051UoWyKNvu6wFo1OO97lGuu8uuY5hqUwG4ic9ApIcM/D173MP1k++jcB+hN7jjli 2lxOc6BU3PQrBz/LbaRSbN4lrm/W9zm4HiQ+LyHeCOOmARW/AFDConrK36VBeUxk8EFL UH3Ycs9rmwzrXzlAfbrROLNJw1zyc9H3/4HrqK4js8OLruYm2fDNUe3VVaPf2a8dkQT/ B8qujJXfXkZAugTxOFTnkTmT1pFMpqdhsPG9XlbWlOHNsKeIJa40a3fz83xexXvcrgkv 9TBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=uYBCEIavREY3lOTjzYq0/RHuyfWzkPb8jleZDn9aV5I=; b=Irj9py5MmH20RW0lvaK5kR06fv82fTrCjPh75p9m1md0u0rQvoX6Mgj7ze94AbjAXZ 8HGiRLatyZoQK2yYoJk/RqMrJtJhblkmCPwbE59BrlhVWcCC2kQZjAyt/s/Dwo5GP81G A7KAOMAZU1lxhY3XVhyTlsLZm5PjYrHGWEGg93ev47il7JJhZOx4hd9A3Bjulhsce0ID QLF0Wl11lBS9cgZ04mx5RuYL4JWrBTxPFyAUeeVOBSeLQz0sj64Tg2Pt9+epHqp8Fy+o ahW10VcBRvbQDu/Cz8X14J8bBPt/3NReqvdVglxV1FWtAMXBjyAqcnRmVCBROa3jr9fv 2m6w== X-Gm-Message-State: APjAAAVn/nLGqqkjnUoReY48jhcoTVloEcwFR/g5Idd3EucJfZbbMDJI an3plq/W88cnmriIAhDEhJBPGvzzfJ0iqwafuzjVlYTd0yg6XAPPRrHJM5No9IyzVX/FiUvl9LF N0GJPAZsNzlHTGt0cRR0ucNWZov75+CL1nooL3EjCyqj2m2SINiyqqeD9/4pY0DGsRcutEllnkG pN0mMNljWjIA== X-Google-Smtp-Source: APXvYqwcXHzYMe3fQqFOLPNDFhLug9a8oBqTWbKXJ7GLRMaEsBN6/1UjZyfY7qKnm25wToVVrCyI0g== X-Received: by 2002:a1c:b607:: with SMTP id g7mr9885134wmf.110.1580065485927; Sun, 26 Jan 2020 11:04:45 -0800 (PST) Received: from [10.8.8.11] ([185.94.189.189]) by smtp.gmail.com with ESMTPSA id v3sm17191781wru.32.2020.01.26.11.04.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 26 Jan 2020 11:04:45 -0800 (PST) Subject: Re: Add %x to PROMPT1 and PROMPT2 To: Fabien COELHO Cc: PostgreSQL-development References: <09502c40-cfe1-bb29-10f9-4b3fa7b2bbb2@2ndquadrant.com> From: Vik Fearing Message-ID: Date: Sun, 26 Jan 2020 20:04:41 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------66CBC47A519F32225DC63F70" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------66CBC47A519F32225DC63F70 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit On 26/01/2020 19:48, Fabien COELHO wrote: > > Hello Vik, > >> I cannot ever think of a time when I don't want to know if I'm in a >> transaction or not (and what its state is).  Every new setup I do, I add >> %x to the psql prompt. >> >> I think it should be part of the default prompt.  Path attached. > > Isn't there examples in the documentation which use the default prompts? > > If so, should they be updated accordingly? Good catch! I thought about the documentation but not the examples therein. Updated patch attached. -- Vik Fearing --------------66CBC47A519F32225DC63F70 Content-Type: text/x-patch; charset=UTF-8; name="0001-Add-x-to-the-default-psql-prompt.v2.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Add-x-to-the-default-psql-prompt.v2.patch" From fed7b95e13b3812d7756188f3b907389f2c45904 Mon Sep 17 00:00:00 2001 From: Vik Fearing Date: Fri, 23 Nov 2018 22:26:18 +0100 Subject: [PATCH] Add %x to the default psql prompt. --- doc/src/sgml/logicaldecoding.sgml | 6 +++--- doc/src/sgml/ref/psql-ref.sgml | 2 +- src/bin/psql/settings.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/src/sgml/logicaldecoding.sgml b/doc/src/sgml/logicaldecoding.sgml index 8db968641e..bce6d379bf 100644 --- a/doc/src/sgml/logicaldecoding.sgml +++ b/doc/src/sgml/logicaldecoding.sgml @@ -92,9 +92,9 @@ postgres=# SELECT * FROM pg_logical_slot_get_changes('regression_slot', NULL, NU (0 rows) postgres=# BEGIN; -postgres=# INSERT INTO data(data) VALUES('1'); -postgres=# INSERT INTO data(data) VALUES('2'); -postgres=# COMMIT; +postgres=*# INSERT INTO data(data) VALUES('1'); +postgres=*# INSERT INTO data(data) VALUES('2'); +postgres=*# COMMIT; postgres=# SELECT * FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL); lsn | xid | data diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml index 48b081fd58..20ba105160 100644 --- a/doc/src/sgml/ref/psql-ref.sgml +++ b/doc/src/sgml/ref/psql-ref.sgml @@ -4332,7 +4332,7 @@ testdb=> \set PROMPT1 '%[%033[1;33;40m%]%n@%/%R%[%033[0m%]%# ' To insert a percent sign into your prompt, write %%. The default prompts are - '%/%R%# ' for prompts 1 and 2, and + '%/%R%x%# ' for prompts 1 and 2, and '>> ' for prompt 3. diff --git a/src/bin/psql/settings.h b/src/bin/psql/settings.h index d2a9d4836a..2b384a38a1 100644 --- a/src/bin/psql/settings.h +++ b/src/bin/psql/settings.h @@ -23,8 +23,8 @@ #define DEFAULT_EDITOR_LINENUMBER_ARG "+" #endif -#define DEFAULT_PROMPT1 "%/%R%# " -#define DEFAULT_PROMPT2 "%/%R%# " +#define DEFAULT_PROMPT1 "%/%R%x%# " +#define DEFAULT_PROMPT2 "%/%R%x%# " #define DEFAULT_PROMPT3 ">> " /* -- 2.17.1 --------------66CBC47A519F32225DC63F70--