aboutsummaryrefslogtreecommitdiff
path: root/src/bin/psql/command.c
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2024-12-18 15:16:12 +0900
committerMichael Paquier <michael@paquier.xyz>2024-12-18 15:16:12 +0900
commit477728b5d6fa16461b81cd22b0568fec1eab97ac (patch)
tree5f675621947600a0d6e74be65e20a02380a4769f /src/bin/psql/command.c
parent4b99fed7541e330b669fe488a274c0c69490391c (diff)
downloadpostgresql-477728b5d6fa16461b81cd22b0568fec1eab97ac.tar.gz
postgresql-477728b5d6fa16461b81cd22b0568fec1eab97ac.zip
psql: Add more information about service name
This commit adds support for the following items in psql, able to show a service name, when available: - Variable SERVICE. - Substitution %s in PROMPT{1,2,3}. This relies on 4b99fed7541e, that has made the service name available in PGconn for libpq. Author: Michael Banck Reviewed-by: Greg Sabino Mullane Discussion: https://postgr.es/m/6723c612.050a0220.1567f4.b94a@mx.google.com
Diffstat (limited to 'src/bin/psql/command.c')
-rw-r--r--src/bin/psql/command.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 1f3cbb11f7c..cd16f27947a 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -4082,6 +4082,7 @@ SyncVariables(void)
pset.sversion = PQserverVersion(pset.db);
SetVariable(pset.vars, "DBNAME", PQdb(pset.db));
+ SetVariable(pset.vars, "SERVICE", PQservice(pset.db));
SetVariable(pset.vars, "USER", PQuser(pset.db));
SetVariable(pset.vars, "HOST", PQhost(pset.db));
SetVariable(pset.vars, "PORT", PQport(pset.db));
@@ -4115,6 +4116,7 @@ void
UnsyncVariables(void)
{
SetVariable(pset.vars, "DBNAME", NULL);
+ SetVariable(pset.vars, "SERVICE", NULL);
SetVariable(pset.vars, "USER", NULL);
SetVariable(pset.vars, "HOST", NULL);
SetVariable(pset.vars, "PORT", NULL);