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.
-- 
Vik Fearing
>From 6118b8b2ab4cfc70525666b8d57eaa351d6c2a3d Mon Sep 17 00:00:00 2001
From: Vik Fearing <vik.fear...@2ndquadrant.com>
Date: Fri, 23 Nov 2018 22:26:18 +0100
Subject: [PATCH] add %x to the default psql prompt

---
 doc/src/sgml/ref/psql-ref.sgml | 2 +-
 src/bin/psql/settings.h        | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

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=&gt; \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>'&gt;&gt; '</literal> for prompt 3.
     </para>
 
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

Reply via email to