leading slash to behave as a unix socket path.
-PGPORT sets the default port or local Unix domain socket
-file extension for communicating with the
Postgres
-backend.
+PGPORT and PGUNIXSOCKET set the default
+port or local Unix domain socket file extension for communicating with
-
- -k, --unixsocket path
-
- Specifies the Unix-domain socket on which the
- Without this option, the socket is created in /tmp
- based on the port number.
-
-
-
-
-U, --username username
-
- -k, --unixsocket path
-
- Specifies the Unix-domain socket on which the
- Without this option, the socket is created in /tmp
- based on the port number.
-
-
-
-
-U, --username username
-
- -k, --unixsocket path
-
- Specifies the Unix-domain socket on which the
- Without this option, the socket is created in /tmp
- based on the port number.
-
-
-
-
-e, --echo
-
- -k, --unixsocket path
-
- Specifies the Unix-domain socket on which the
- Without this option, the socket is created in /tmp
- based on the port number.
-
-
-
-
-U, --username username
-
- -k, --unixsocket path
-
- Specifies the Unix-domain socket on which the
- Without this option, the socket is created in /tmp
- based on the port number.
-
-
-
-
-U, --username username
-
- -k, --unixsocket path
-
- Specifies the Unix-domain socket on which the
- Without this option, the socket is created in /tmp
- based on the port number.
-
-
-
-
-e, --echo
pg_dump [ dbname ]
pg_dump [ -h host ]
- [ -k path ]
[ -p port ]
[ -t table ]
[ -a ] [ -c ] [ -d ] [ -D ] [ -i ] [ -n ] [ -N ]
-
- -k path
-
- Specifies the local Unix domain socket file path
- on which the
postmaster
- is listening for connections.
- Without this option, the socket path name defaults to
- the value of the PGUNIXSOCKET environment
- variable (if set), otherwise it is constructed
- from the port number.
-
-
-
-
-p port
1999-07-20
-pg_dumpall [ -h host ] [ -k path ] [ -p port ] [ -a ] [ -d ] [ -D ] [ -O ] [ -s ] [ -u ] [ -v ] [ -x ] [ --accounts-only ]
+pg_dumpall [ -h host ] [ -p port ] [ -a ] [ -d ] [ -D ] [ -O ] [ -s ] [ -u ] [ -v ] [ -x ] [ --accounts-only ]
-
- -k path
-
- Specifies the local Unix domain socket file path
- on which the
postmaster
- is listening for connections.
- Without this option, the socket path name defaults to
- the value of the PGUNIXSOCKET environment
- variable (if set), otherwise it is constructed
- from the port number.
-
-
-
-
-p port
-
- -k, --unixsocket path
-
- Specifies the Unix-domain socket on which the
- Without this option, the socket is created in /tmp
- based on the port number.
-
-
-
-
-
-H, --html
-
- -k, --unixsocket path
-
- Specifies the Unix-domain socket on which the
- Without this option, the socket is created in /tmp
- based on the port number.
-
-
-
-
-U username
--username username
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.183 2000/11/13 15:18:11 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.184 2000/11/13 23:37:52 momjian Exp $
*
* NOTES
*
{
char msg[1024];
snprintf(msg, sizeof(msg),
- "FATAL: get_host_port: gethostbyname(%s) failed: %s\n",
- HostName, hstrerror(h_errno));
+ "FATAL: get_host_port: gethostbyname(%s) failed\n",
+ HostName);
fputs(msg, stderr);
pqdebug("%s", msg);
exit(1);
int useDB;
char *dbname;
- char *pghost;
char *pgport;
- char *pgunixsocket;
+ char *pghost;
int ignoreVersion;
int requirePassword;
const char* dbname,
const char* pghost,
const char* pgport,
- const char* pgunixsocket,
const int reqPwd,
const int ignoreVersion);
if (AH->version < K_VERS_1_3)
die_horribly(AH, "Direct database connections are not supported in pre-1.3 archives");
- ConnectDatabase(AHX, ropt->dbname, ropt->pghost, ropt->pgport,
- ropt->pgunixsocket, ropt->requirePassword,
- ropt->ignoreVersion);
+ ConnectDatabase(AHX, ropt->dbname, ropt->pghost, ropt->pgport,
+ ropt->requirePassword, ropt->ignoreVersion);
/*
* If no superuser was specified then see if the current user will do...
char *archdbname; /* DB name *read* from archive */
char *pghost;
char *pgport;
- char *pgunixsocket;
PGconn *connection;
PGconn *blobConnection; /* Connection for BLOB xref */
int txActive; /* Flag set if TX active on connection */
const char* dbname,
const char* pghost,
const char* pgport,
- const char* pgunixsocket,
const int reqPwd,
const int ignoreVersion)
{
else
AH->pgport = NULL;
- if (pgunixsocket != NULL)
- {
- AH->pgport = strdup(pgunixsocket);
- sprintf(tmp_string, "unixsocket=%s ", AH->pgunixsocket);
- strcat(connect_string, tmp_string);
- }
- else
- AH->pgunixsocket = NULL;
-
sprintf(tmp_string, "dbname=%s ", AH->dbname);
strcat(connect_string, tmp_string);
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.178 2000/11/13 15:18:13 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.179 2000/11/13 23:37:52 momjian Exp $
*
*
" -F, --format {c|f|p} output file format (custom, files, plain text)\n"
" -h, --host server host name\n"
" -i, --ignore-version proceed when database version != pg_dump version\n"
- " -k, --unixsocket
server Unix-domain socket name\n"
" -n, --no-quotes suppress most quotes around identifiers\n"
" -N, --quotes enable most quotes around identifiers\n"
" -o, --oids dump object ids (oids)\n"
" -F {c|f|p} output file format (custom, files, plain text)\n"
" -h server host name\n"
" -i proceed when database version != pg_dump version\n"
- " -k
server Unix-domain socket name\n"
" -n suppress most quotes around identifiers\n"
" -N enable most quotes around identifiers\n"
" -o dump object ids (oids)\n"
const char *dbname = NULL;
const char *pghost = NULL;
const char *pgport = NULL;
- const char *pgunixsocket = NULL;
char *tablename = NULL;
bool oids = false;
TableInfo *tblinfo;
{"attribute-inserts", no_argument, NULL, 'D'},
{"host", required_argument, NULL, 'h'},
{"ignore-version", no_argument, NULL, 'i'},
- {"unixsocket", required_argument, NULL, 'k'},
{"no-reconnect", no_argument, NULL, 'R'},
{"no-quotes", no_argument, NULL, 'n'},
{"quotes", no_argument, NULL, 'N'},
ignore_version = true;
break;
- case 'k': /* server Unix-domain socket */
- pgunixsocket = optarg;
- break;
-
case 'n': /* Do not force double-quotes on
* identifiers */
force_quotes = false;
dbname = argv[optind];
/* Open the database using the Archiver, so it knows about it. Errors mean death */
- g_conn = ConnectDatabase(g_fout, dbname, pghost, pgport, pgunixsocket,
- use_password, ignore_version);
+ g_conn = ConnectDatabase(g_fout, dbname, pghost, pgport, use_password, ignore_version);
/*
* Start serializable transaction to dump consistent data
{ "ignore-version", 0, NULL, 'i'},
{ "index", 2, NULL, 'I'},
{ "list", 0, NULL, 'l'},
- { "unixsocket", 1, NULL, 'k' },
{ "no-acl", 0, NULL, 'x' },
{ "no-owner", 0, NULL, 'O'},
{ "no-reconnect", 0, NULL, 'R' },
progname = *argv;
#ifdef HAVE_GETOPT_LONG
- while ((c = getopt_long(argc, argv, "acCd:f:F:h:i:k:lNoOp:P:rRsS:t:T:uU:vx", cmdopts, NULL)) != EOF)
+ while ((c = getopt_long(argc, argv, "acCd:f:F:h:i:lNoOp:P:rRsS:t:T:uU:vx", cmdopts, NULL)) != EOF)
#else
- while ((c = getopt(argc, argv, "acCd:f:F:h:i:k:lNoOp:P:rRsS:t:T:uU:vx")) != -1)
+ while ((c = getopt(argc, argv, "acCd:f:F:h:i:lNoOp:P:rRsS:t:T:uU:vx")) != -1)
#endif
{
switch (c)
case 'i':
opts->ignoreVersion = 1;
break;
- case 'k':
- if (strlen(optarg) != 0)
- opts->pgunixsocket = strdup(optarg);
- break;
case 'N':
opts->origOrder = 1;
break;
*
* Copyright 2000 by PostgreSQL Global Development Group
*
- * $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.37 2000/11/13 15:18:14 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.38 2000/11/13 23:37:53 momjian Exp $
*/
#include "postgres.h"
#include "command.h"
SetVariable(pset.vars, "USER", NULL);
SetVariable(pset.vars, "HOST", NULL);
SetVariable(pset.vars, "PORT", NULL);
- SetVariable(pset.vars, "UNIXSOCKET", NULL);
SetVariable(pset.vars, "ENCODING", NULL);
/* If dbname is "" then use old name, else new one (even if NULL) */
do
{
need_pass = false;
- /* FIXME use PQconnectdb to support passing the Unix socket */
pset.db = PQsetdbLogin(PQhost(oldconn), PQport(oldconn),
NULL, NULL, dbparam, userparam, pwparam);
SetVariable(pset.vars, "USER", PQuser(pset.db));
SetVariable(pset.vars, "HOST", PQhost(pset.db));
SetVariable(pset.vars, "PORT", PQport(pset.db));
- SetVariable(pset.vars, "UNIXSOCKET", PQunixsocket(pset.db));
SetVariable(pset.vars, "ENCODING", pg_encoding_to_char(pset.encoding));
pset.issuper = test_superuser(PQuser(pset.db));
*
* Copyright 2000 by PostgreSQL Global Development Group
*
- * $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.24 2000/11/13 15:18:14 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.25 2000/11/13 23:37:53 momjian Exp $
*/
#include "postgres.h"
#include "common.h"
SetVariable(pset.vars, "DBNAME", NULL);
SetVariable(pset.vars, "HOST", NULL);
SetVariable(pset.vars, "PORT", NULL);
- SetVariable(pset.vars, "UNIXSOCKET", NULL);
SetVariable(pset.vars, "USER", NULL);
SetVariable(pset.vars, "ENCODING", NULL);
return NULL;
SetVariable(pset.vars, "DBNAME", NULL);
SetVariable(pset.vars, "HOST", NULL);
SetVariable(pset.vars, "PORT", NULL);
- SetVariable(pset.vars, "UNIXSOCKET", NULL);
SetVariable(pset.vars, "USER", NULL);
SetVariable(pset.vars, "ENCODING", NULL);
return false;
*
* Copyright 2000 by PostgreSQL Global Development Group
*
- * $Header: /cvsroot/pgsql/src/bin/psql/help.c,v 1.33 2000/11/13 15:18:14 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/help.c,v 1.34 2000/11/13 23:37:53 momjian Exp $
*/
#include "postgres.h"
#include "help.h"
puts(")");
puts(" -H HTML table output mode (-P format=html)");
-
- /* Display default Unix-domain socket */
- env = getenv("PGUNIXSOCKET");
- printf(" -k
Specify Unix domain socket name (default: ");
- if (env)
- fputs(env, stdout);
- else
- fputs("computed from the port", stdout);
- puts(")");
-
puts(" -l List available databases, then exit");
puts(" -n Disable readline");
puts(" -o Send query output to filename (or |pipe)");
*
* Copyright 2000 by PostgreSQL Global Development Group
*
- * $Header: /cvsroot/pgsql/src/bin/psql/prompt.c,v 1.14 2000/11/13 15:18:14 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/prompt.c,v 1.15 2000/11/13 23:37:53 momjian Exp $
*/
#include "postgres.h"
#include "prompt.h"
if (pset.db && PQport(pset.db))
strncpy(buf, PQport(pset.db), MAX_PROMPT_SIZE);
break;
- /* DB server Unix-domain socket */
- case '<':
- if (pset.db && PQunixsocket(pset.db))
- strncpy(buf, PQunixsocket(pset.db), MAX_PROMPT_SIZE);
- break;
/* DB server user name */
case 'n':
if (pset.db)
*
* Copyright 2000 by PostgreSQL Global Development Group
*
- * $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.38 2000/11/13 15:18:14 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.39 2000/11/13 23:37:53 momjian Exp $
*/
#include "postgres.h"
char *dbname;
char *host;
char *port;
- char *unixsocket;
char *username;
enum _actions action;
char *action_string;
do
{
need_pass = false;
- /* FIXME use PQconnectdb to allow setting the unix socket */
pset.db = PQsetdbLogin(options.host, options.port, NULL, NULL,
options.action == ACT_LIST_DB ? "template1" : options.dbname,
username, password);
SetVariable(pset.vars, "USER", PQuser(pset.db));
SetVariable(pset.vars, "HOST", PQhost(pset.db));
SetVariable(pset.vars, "PORT", PQport(pset.db));
- SetVariable(pset.vars, "UNIXSOCKET", PQunixsocket(pset.db));
SetVariable(pset.vars, "ENCODING", pg_encoding_to_char(pset.encoding));
#ifndef WIN32
{"field-separator", required_argument, NULL, 'F'},
{"host", required_argument, NULL, 'h'},
{"html", no_argument, NULL, 'H'},
- {"unixsocket", required_argument, NULL, 'k'},
{"list", no_argument, NULL, 'l'},
{"no-readline", no_argument, NULL, 'n'},
{"output", required_argument, NULL, 'o'},
memset(options, 0, sizeof *options);
#ifdef HAVE_GETOPT_LONG
- while ((c = getopt_long(argc, argv, "aAc:d:eEf:F:lh:Hk:no:p:P:qRsStT:uU:v:VWxX?", long_options, &optindex)) != -1)
+ while ((c = getopt_long(argc, argv, "aAc:d:eEf:F:lh:Hno:p:P:qRsStT:uU:v:VWxX?", long_options, &optindex)) != -1)
#else /* not HAVE_GETOPT_LONG */
/*
* Be sure to leave the '-' in here, so we can catch accidental long
* options.
*/
- while ((c = getopt(argc, argv, "aAc:d:eEf:F:lh:Hk:no:p:P:qRsStT:uU:v:VWxX?-")) != -1)
+ while ((c = getopt(argc, argv, "aAc:d:eEf:F:lh:Hno:p:P:qRsStT:uU:v:VWxX?-")) != -1)
#endif /* not HAVE_GETOPT_LONG */
{
switch (c)
case 'l':
options->action = ACT_LIST_DB;
break;
- case 'k':
- options->unixsocket = optarg;
- break;
case 'n':
options->no_readline = true;
break;
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createdb,v 1.10 2000/11/13 15:18:14 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createdb,v 1.11 2000/11/13 23:37:53 momjian Exp $
#
#-------------------------------------------------------------------------
--port=*)
PSQLOPT="$PSQLOPT -p "`echo $1 | sed 's/^--port=//'`
;;
- --unixsocket|-k)
- PSQLOPT="$PSQLOPT -k $2"
- shift;;
- -k*)
- PSQLOPT="$PSQLOPT $1"
- ;;
- --unixsocket=*)
- PSQLOPT="$PSQLOPT -k "`echo $1 | sed 's/^--unixsocket=//'`
- ;;
--username|-U)
PSQLOPT="$PSQLOPT -U $2"
shift;;
echo " -E, --encoding=ENCODING Multibyte encoding for the database"
echo " -h, --host=HOSTNAME Database server host"
echo " -p, --port=PORT Database server port"
- echo " -k, --unixsocket=PATH Database server Unix-domain socket name"
echo " -U, --username=USERNAME Username to connect as"
echo " -W, --password Prompt for password"
echo " -e, --echo Show the query being sent to the backend"
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createlang.sh,v 1.18 2000/11/13 15:18:14 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createlang.sh,v 1.19 2000/11/13 23:37:53 momjian Exp $
#
#-------------------------------------------------------------------------
--port=*)
PSQLOPT="$PSQLOPT -p "`echo $1 | sed 's/^--port=//'`
;;
- --unixsocket|-k)
- PSQLOPT="$PSQLOPT -k $2"
- shift;;
- -k*)
- PSQLOPT="$PSQLOPT $1"
- ;;
- --unixsocket=*)
- PSQLOPT="$PSQLOPT -k "`echo $1 | sed 's/^--unixsocket=//'`
- ;;
--username|-U)
PSQLOPT="$PSQLOPT -U $2"
shift;;
echo "Options:"
echo " -h, --host=HOSTNAME Database server host"
echo " -p, --port=PORT Database server port"
- echo " -k, --unixsocket=PATH Database server Unix-domain socket name"
echo " -U, --username=USERNAME Username to connect as"
echo " -W, --password Prompt for password"
echo " -d, --dbname=DBNAME Database to install language in"
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createuser,v 1.13 2000/11/13 15:18:14 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createuser,v 1.14 2000/11/13 23:37:53 momjian Exp $
#
# Note - this should NOT be setuid.
#
--port=*)
PSQLOPT="$PSQLOPT -p "`echo $1 | sed 's/^--port=//'`
;;
- --unixsocket|-k)
- PSQLOPT="$PSQLOPT -k $2"
- shift;;
- -k*)
- PSQLOPT="$PSQLOPT $1"
- ;;
- --unixsocket=*)
- PSQLOPT="$PSQLOPT -k "`echo $1 | sed 's/^--unixsocket=//'`
- ;;
# Note: These two specify the user to connect as (like in psql),
# not the user you're creating.
--username|-U)
echo " -P, --pwprompt Assign a password to new user"
echo " -h, --host=HOSTNAME Database server host"
echo " -p, --port=PORT Database server port"
- echo " -k, --unixsocket=PATH Database server Unix-domain socket name"
echo " -U, --username=USERNAME Username to connect as (not the one to create)"
echo " -W, --password Prompt for password to connect"
echo " -e, --echo Show the query being sent to the backend"
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropdb,v 1.8 2000/11/13 15:18:14 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropdb,v 1.9 2000/11/13 23:37:53 momjian Exp $
#
#-------------------------------------------------------------------------
--port=*)
PSQLOPT="$PSQLOPT -p "`echo $1 | sed 's/^--port=//'`
;;
- --unixsocket|-k)
- PSQLOPT="$PSQLOPT -k $2"
- shift;;
- -k*)
- PSQLOPT="$PSQLOPT $1"
- ;;
- --unixsocket=*)
- PSQLOPT="$PSQLOPT -k "`echo $1 | sed 's/^--unixsocket=//'`
- ;;
--username|-U)
PSQLOPT="$PSQLOPT -U $2"
shift;;
echo "Options:"
echo " -h, --host=HOSTNAME Database server host"
echo " -p, --port=PORT Database server port"
- echo " -k, --unixsocket=PATH Database server Unix-domain socket name"
echo " -U, --username=USERNAME Username to connect as"
echo " -W, --password Prompt for password"
echo " -i, --interactive Prompt before deleting anything"
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/droplang,v 1.9 2000/11/13 15:18:14 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/droplang,v 1.10 2000/11/13 23:37:53 momjian Exp $
#
#-------------------------------------------------------------------------
--port=*)
PSQLOPT="$PSQLOPT -p "`echo $1 | sed 's/^--port=//'`
;;
- --unixsocket|-k)
- PSQLOPT="$PSQLOPT -k $2"
- shift;;
- -k*)
- PSQLOPT="$PSQLOPT $1"
- ;;
- --unixsocket=*)
- PSQLOPT="$PSQLOPT -k "`echo $1 | sed 's/^--unixsocket=//'`
- ;;
--username|-U)
PSQLOPT="$PSQLOPT -U $2"
shift;;
echo "Options:"
echo " -h, --host=HOSTNAME Database server host"
echo " -p, --port=PORT Database server port"
- echo " -k, --unixsocket=PATH Database server Unix-domain socket name"
echo " -U, --username=USERNAME Username to connect as"
echo " -W, --password Prompt for password"
echo " -d, --dbname=DBNAME Database to remove language from"
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropuser,v 1.8 2000/11/13 15:18:14 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropuser,v 1.9 2000/11/13 23:37:53 momjian Exp $
#
# Note - this should NOT be setuid.
#
--port=*)
PSQLOPT="$PSQLOPT -p "`echo $1 | sed 's/^--port=//'`
;;
- --unixsocket|-k)
- PSQLOPT="$PSQLOPT -k $2"
- shift;;
- -k*)
- PSQLOPT="$PSQLOPT $1"
- ;;
- --unixsocket=*)
- PSQLOPT="$PSQLOPT -k "`echo $1 | sed 's/^--unixsocket=//'`
- ;;
# Note: These two specify the user to connect as (like in psql),
# not the user you're dropping.
--username|-U)
echo "Options:"
echo " -h, --host=HOSTNAME Database server host"
echo " -p, --port=PORT Database server port"
- echo " -k, --unixsocket=PATH Database server Unix-domain socket name"
echo " -U, --username=USERNAME Username to connect as (not the one to drop)"
echo " -W, --password Prompt for password to connect"
echo " -i, --interactive Prompt before deleting anything"
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/vacuumdb,v 1.11 2000/11/13 15:18:14 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/vacuumdb,v 1.12 2000/11/13 23:37:53 momjian Exp $
#
#-------------------------------------------------------------------------
--port=*)
PSQLOPT="$PSQLOPT -p "`echo $1 | sed 's/^--port=//'`
;;
- --unixsocket|-k)
- PSQLOPT="$PSQLOPT -k $2"
- shift;;
- -k*)
- PSQLOPT="$PSQLOPT $1"
- ;;
- --unixsocket=*)
- PSQLOPT="$PSQLOPT -k "`echo $1 | sed 's/^--unixsocket=//'`
- ;;
--username|-U)
PSQLOPT="$PSQLOPT -U $2"
shift;;
echo "Options:"
echo " -h, --host=HOSTNAME Database server host"
echo " -p, --port=PORT Database server port"
- echo " -k, --unixsocket=PATH Database server Unix-domain socket name"
echo " -U, --username=USERNAME Username to connect as"
echo " -W, --password Prompt for password"
echo " -d, --dbname=DBNAME Database to vacuum"
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.145 2000/11/13 15:18:15 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.146 2000/11/13 23:37:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
*/
PQconninfoFree(connOptions);
+ /* ----------
+ * Allow unix socket specification in the host name
+ * ----------
+ */
+ if (conn->pghost && conn->pghost[0] == '/')
+ {
+ if (conn->pgunixsocket)
+ free(conn->pgunixsocket);
+ conn->pgunixsocket = conn->pghost;
+ conn->pghost = NULL;
+ }
+ if (conn->pghostaddr && conn->pghostaddr[0] == '/')
+ {
+ if (conn->pgunixsocket)
+ free(conn->pgunixsocket);
+ conn->pgunixsocket = conn->pghostaddr;
+ conn->pghostaddr = NULL;
+ }
+
/* ----------
* Connect to the database
* ----------
else
conn->pgport = strdup(pgport);
-#if FIX_ME
- /* we need to modify the function to accept a unix socket path */
- if (pgunixsocket)
- conn->pgunixsocket = strdup(pgunixsocket);
- else if ((tmp = getenv("PGUNIXSOCKET")) != NULL)
- conn->pgunixsocket = strdup(tmp);
-#endif
+ /* ----------
+ * We don't allow unix socket path as a function parameter.
+ * This allows unix socket specification in the host name.
+ * ----------
+ */
+ if (conn->pghost && conn->pghost[0] == '/')
+ {
+ if (conn->pgunixsocket)
+ free(conn->pgunixsocket);
+ conn->pgunixsocket = conn->pghost;
+ conn->pghost = NULL;
+ }
+ if (conn->pghostaddr && conn->pghostaddr[0] == '/')
+ {
+ if (conn->pgunixsocket)
+ free(conn->pgunixsocket);
+ conn->pgunixsocket = conn->pghostaddr;
+ conn->pghostaddr = NULL;
+ }
if (pgtty == NULL)
{
{
printfPQExpBuffer(&conn->errorMessage,
"connectDBStart() -- "
- "invalid host address: %s\n", conn->pghostaddr);
+ "invalid host address: %s\n", conn->pghostaddr);
goto connect_errReturn;
}
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: libpq-int.h,v 1.28 2000/11/13 15:18:15 momjian Exp $
+ * $Id: libpq-int.h,v 1.29 2000/11/13 23:37:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* numbers-and-dots notation. Takes
* precedence over above. */
char *pgport; /* the server's communication port */
- char *pgunixsocket; /* the Unix-domain socket that the server is listening on;
- * if NULL, uses a default constructed from pgport */
+ char *pgunixsocket; /* the Unix-domain socket that the server is listening on;
+ * if NULL, uses a default constructed from pgport */
char *pgtty; /* tty on which the backend messages is
* displayed (NOT ACTUALLY USED???) */
char *pgoptions; /* options to start the backend with */