From: Vik Fearing <vik.fearing@2ndquadrant.com>
To: Fabien COELHO <coelho@cri.ensmp.fr>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: Add %x to PROMPT1 and PROMPT2
Date: Sun, 26 Jan 2020 20:04:41 +0100
Message-ID: <e04078e8-ae4a-b09d-896d-5f2f5a042248@2ndquadrant.com> (raw)
In-Reply-To: <alpine.DEB.2.21.2001261946530.29788@pseudo>
References: <09502c40-cfe1-bb29-10f9-4b3fa7b2bbb2@2ndquadrant.com>
<alpine.DEB.2.21.2001261946530.29788@pseudo>
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
Attachments:
[text/x-patch] 0001-Add-x-to-the-default-psql-prompt.v2.patch (2.1K, ../e04078e8-ae4a-b09d-896d-5f2f5a042248@2ndquadrant.com/2-0001-Add-x-to-the-default-psql-prompt.v2.patch)
download | inline diff:
From fed7b95e13b3812d7756188f3b907389f2c45904 Mon Sep 17 00:00:00 2001
From: Vik Fearing <vik.fearing@2ndquadrant.com>
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.sgmlindex 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.sgmlindex 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
<literal>%%</literal>. The default prompts are
- <literal>'%/%R%# '</literal> for prompts 1 and 2, and+ <literal>'%/%R%x%# '</literal> for prompts 1 and 2, and
<literal>'>> '</literal> for prompt 3.
</para>
diff --git a/src/bin/psql/settings.h b/src/bin/psql/settings.hindex 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: vik.fearing@2ndquadrant.com, coelho@cri.ensmp.fr
Subject: Re: Add %x to PROMPT1 and PROMPT2
In-Reply-To: <e04078e8-ae4a-b09d-896d-5f2f5a042248@2ndquadrant.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox