diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2020-11-25 08:14:23 +0100 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2020-11-25 08:33:57 +0100 |
commit | c9f0624bc2f544baacafa38e3797d5323401d039 (patch) | |
tree | 4425354e0eb7391059df513989a9aa62cd237b65 /src/bin/psql/command.c | |
parent | a7e65dc88b6f088fc2fcf5a660d866de644b1300 (diff) |
Add support for abstract Unix-domain sockets
This is a variant of the normal Unix-domain sockets that don't use the
file system but a separate "abstract" namespace. At the user
interface, such sockets are represented by names starting with "@".
Supported on Linux and Windows right now.
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://www.postgresql.org/message-id/flat/6dee8574-b0ad-fc49-9c8c-2edc796f0033@2ndquadrant.com
Diffstat (limited to 'src/bin/psql/command.c')
-rw-r--r-- | src/bin/psql/command.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index c7a83d5dfc5..55b349d55a3 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -37,6 +37,7 @@ #include "input.h" #include "large_obj.h" #include "libpq-fe.h" +#include "libpq/pqcomm.h" #include "mainloop.h" #include "portability/instr_time.h" #include "pqexpbuffer.h" @@ -604,12 +605,9 @@ exec_command_conninfo(PsqlScanState scan_state, bool active_branch) char *host = PQhost(pset.db); char *hostaddr = PQhostaddr(pset.db); - /* - * If the host is an absolute path, the connection is via socket - * unless overridden by hostaddr - */ - if (is_absolute_path(host)) + if (is_unixsock_path(host)) { + /* hostaddr overrides host */ if (hostaddr && *hostaddr) printf(_("You are connected to database \"%s\" as user \"%s\" on address \"%s\" at port \"%s\".\n"), db, PQuser(pset.db), hostaddr, PQport(pset.db)); @@ -3407,12 +3405,9 @@ do_connect(enum trivalue reuse_previous_specification, char *host = PQhost(pset.db); char *hostaddr = PQhostaddr(pset.db); - /* - * If the host is an absolute path, the connection is via socket - * unless overridden by hostaddr - */ - if (is_absolute_path(host)) + if (is_unixsock_path(host)) { + /* hostaddr overrides host */ if (hostaddr && *hostaddr) printf(_("You are now connected to database \"%s\" as user \"%s\" on address \"%s\" at port \"%s\".\n"), PQdb(pset.db), PQuser(pset.db), hostaddr, PQport(pset.db)); |