[Patch] New psql prompt substitution %r (m = master, r = replica) - Mailing list pgsql-hackers

From Aleksander Alekseev
Subject [Patch] New psql prompt substitution %r (m = master, r = replica)
Date
Msg-id 20160811130419.4ad7afd5@e733
Whole thread Raw
Responses Re: [Patch] New psql prompt substitution %r (m = master, r = replica)
Re: [Patch] New psql prompt substitution %r (m = master, r = replica)
List pgsql-hackers
Hello.

Suggested patch introduces an %r substitution in psql's prompt. This
substitution allows to display whether user is connected to master or
replica right in a prompt.

Usage example:

```
$ cat ~/.psqlrc
\set PROMPT1 '%p (%r) =# '

$ psql -p 5432
psql (9.6beta4)
Type "help" for help.

20638 (m) =# \q

$ psql -p 5433
psql (9.6beta4)
Type "help" for help.

20647 (r) =# \q
```

Currently I'm working on some functionality involving master-slave
replication. Sometimes I accidentally connect to a master instead of
replica and vice versa. Presence of functionality described above would
make my work much more convenient.

Hopefully there are other people in PostgreSQL community who feel that
way.

--
Best regards,
Aleksander Alekseev

Attachment

pgsql-hackers by date:

Previous
From: Artur Zakirov
Date:
Subject: Re: Bug in to_timestamp().
Next
From: Shay Rojansky
Date:
Subject: Re: Slowness of extended protocol