Skip to content

Commit dcdbb5a

Browse files
committed
Add %x to default PROMPT1 and PROMPT2 in psql
%d can be used to track if the current connection is in a transaction block or not, and adding it by default to the prompt has the advantage to not need a modification of .psqlrc, something not possible depending on the environment. This discussion has happened across various sources, and there was a strong consensus in favor of this change. Author: Vik Fearing Reviewed-by: Fabien Coelho Discussion: https://postgr.es/m/09502c40-cfe1-bb29-10f9-4b3fa7b2bbb2@2ndquadrant.com
1 parent 43e0841 commit dcdbb5a

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

doc/src/sgml/logicaldecoding.sgml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ postgres=# SELECT * FROM pg_logical_slot_get_changes('regression_slot', NULL, NU
9292
(0 rows)
9393

9494
postgres=# BEGIN;
95-
postgres=# INSERT INTO data(data) VALUES('1');
96-
postgres=# INSERT INTO data(data) VALUES('2');
97-
postgres=# COMMIT;
95+
postgres=*# INSERT INTO data(data) VALUES('1');
96+
postgres=*# INSERT INTO data(data) VALUES('2');
97+
postgres=*# COMMIT;
9898

9999
postgres=# SELECT * FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL);
100100
lsn | xid | data

doc/src/sgml/ref/psql-ref.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4332,7 +4332,7 @@ testdb=> \set PROMPT1 '%[%033[1;33;40m%]%n@%/%R%[%033[0m%]%# '
43324332

43334333
To insert a percent sign into your prompt, write
43344334
<literal>%%</literal>. The default prompts are
4335-
<literal>'%/%R%# '</literal> for prompts 1 and 2, and
4335+
<literal>'%/%R%x%# '</literal> for prompts 1 and 2, and
43364336
<literal>'&gt;&gt; '</literal> for prompt 3.
43374337
</para>
43384338

src/bin/psql/settings.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
#define DEFAULT_EDITOR_LINENUMBER_ARG "+"
2424
#endif
2525

26-
#define DEFAULT_PROMPT1 "%/%R%# "
27-
#define DEFAULT_PROMPT2 "%/%R%# "
26+
#define DEFAULT_PROMPT1 "%/%R%x%# "
27+
#define DEFAULT_PROMPT2 "%/%R%x%# "
2828
#define DEFAULT_PROMPT3 ">> "
2929

3030
/*

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy