Remove -k unix socketpath option from client side, allow hostname with
authorBruce Momjian
Mon, 13 Nov 2000 23:37:54 +0000 (23:37 +0000)
committerBruce Momjian
Mon, 13 Nov 2000 23:37:54 +0000 (23:37 +0000)
leading slash to behave as a unix socket path.

32 files changed:
doc/src/sgml/libpq.sgml
doc/src/sgml/ref/createdb.sgml
doc/src/sgml/ref/createlang.sgml
doc/src/sgml/ref/createuser.sgml
doc/src/sgml/ref/dropdb.sgml
doc/src/sgml/ref/droplang.sgml
doc/src/sgml/ref/dropuser.sgml
doc/src/sgml/ref/pg_dump.sgml
doc/src/sgml/ref/pg_dumpall.sgml
doc/src/sgml/ref/psql-ref.sgml
doc/src/sgml/ref/vacuumdb.sgml
src/backend/postmaster/postmaster.c
src/bin/pg_dump/pg_backup.h
src/bin/pg_dump/pg_backup_archiver.c
src/bin/pg_dump/pg_backup_archiver.h
src/bin/pg_dump/pg_backup_db.c
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_restore.c
src/bin/psql/command.c
src/bin/psql/common.c
src/bin/psql/help.c
src/bin/psql/prompt.c
src/bin/psql/startup.c
src/bin/scripts/createdb
src/bin/scripts/createlang.sh
src/bin/scripts/createuser
src/bin/scripts/dropdb
src/bin/scripts/droplang
src/bin/scripts/dropuser
src/bin/scripts/vacuumdb
src/interfaces/libpq/fe-connect.c
src/interfaces/libpq/libpq-int.h

index d9b96b862007aba592bacd52f4b71fd084e52235..c742df415d0c4a87fe36e10619f6a3a316ad18b0 100644 (file)
@@ -1,5 +1,5 @@
 
 
  
@@ -1844,9 +1844,9 @@ Without a host name, libpq will connect using a local Unix domain socket.
 
 
 
-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
+the Postgres backend.
 
 
 
index d5199e307aa99b5b327907667674c9fdbe41daa1..5bcb543938645e8b9c8cf9aeab7119688e3570b2 100644 (file)
@@ -1,5 +1,5 @@
 
 
@@ -56,18 +56,6 @@ Postgres documentation
       
      
 
-    
-      -k, --unixsocket path
-      
-      
-      Specifies the Unix-domain socket on which the
-      postmaster is running.
-      Without this option, the socket is created in /tmp
-      based on the port number.
-      
-      
-    
-
      
       -U, --username username
       
index 0258646ad7a75d2c7b8e96a25956d6e22cf8784b..87d27442e96472db876ea9927ebcf22a0b6e016d 100644 (file)
@@ -1,5 +1,5 @@
 
 
@@ -101,18 +101,6 @@ Postgres documentation
       
      
 
-    
-      -k, --unixsocket path
-      
-      
-      Specifies the Unix-domain socket on which the
-      postmaster is running.
-      Without this option, the socket is created in /tmp
-      based on the port number.
-      
-      
-    
-
      
       -U, --username username
       
index 9845fcba1e52fa292e08e9aa3bd2198f9ed4d770..9c7a3a262449396bb553f24a46ecf7c29eab8a56 100644 (file)
@@ -1,5 +1,5 @@
 
 
@@ -55,18 +55,6 @@ Postgres documentation
       
      
 
-    
-      -k, --unixsocket path
-      
-      
-      Specifies the Unix-domain socket on which the
-      postmaster is running.
-      Without this option, the socket is created in /tmp
-      based on the port number.
-      
-      
-    
-
      
       -e, --echo
       
index c265c016e963d07a8159cb99abc9551603f7cc44..1eb4c4f46fa8e9a1a1ee3548751565852f3c493c 100644 (file)
@@ -1,5 +1,5 @@
 
 
@@ -55,18 +55,6 @@ Postgres documentation
       
      
 
-    
-      -k, --unixsocket path
-      
-      
-      Specifies the Unix-domain socket on which the
-      postmaster is running.
-      Without this option, the socket is created in /tmp
-      based on the port number.
-      
-      
-    
-
      
       -U, --username username
       
index 5d75a89fdeff8f5e9ecb46f8dc1ae68f3a37dd77..2346a0d32d550c0e365434691e396999e596ff24 100644 (file)
@@ -1,5 +1,5 @@
 
 
@@ -101,18 +101,6 @@ Postgres documentation
       
      
 
-    
-      -k, --unixsocket path
-      
-      
-      Specifies the Unix-domain socket on which the
-      postmaster is running.
-      Without this option, the socket is created in /tmp
-      based on the port number.
-      
-      
-    
-
      
       -U, --username username
       
index a2b1e537e513bdfc42263152117e3c3dcc9e4682..7f8f7899e591c6e0c7755a04641898beaeb7796d 100644 (file)
@@ -1,5 +1,5 @@
 
 
@@ -55,18 +55,6 @@ Postgres documentation
       
      
 
-    
-      -k, --unixsocket path
-      
-      
-      Specifies the Unix-domain socket on which the
-      postmaster is running.
-      Without this option, the socket is created in /tmp
-      based on the port number.
-      
-      
-    
-
      
       -e, --echo
       
index b0ad3e49cfe9a3b99f8d2e623411247b91ec3a38..4406ea94f094275b38c574d6dd105d02562df865 100644 (file)
@@ -1,5 +1,5 @@
 
 
@@ -25,7 +25,6 @@ Postgres documentation
   
 pg_dump [ dbname ]
 pg_dump [ -h host ]
-    [ -k path ]
     [ -p port ]
     [ -t table ]
     [ -a ] [ -c ] [ -d ] [ -D ] [ -i ] [ -n ] [ -N ]
@@ -206,21 +205,6 @@ pg_dump [ -h host ]
       
      
 
-     
-      -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
       
index 1d78b9008c00ea71fea2b58827185c33fdc6b0f0..f6999059d1f60c638c8d1fa42a6ff5d245d29193 100644 (file)
@@ -1,5 +1,5 @@
 
 
@@ -23,7 +23,7 @@ Postgres documentation
    1999-07-20
   
   
-pg_dumpall [ -h host ] [ -path ] [ -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 ]
   
 
   
@@ -149,21 +149,6 @@ pg_dumpall [ -h host ] [ -k 
       
      
 
-     
-      -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
       
index ca8d14f6de8d75d1592f1f11a565f051e086a2cf..1780fcfcc8be2b5f2164f7bc1265fcfe06ff1073 100644 (file)
@@ -1,5 +1,5 @@
 
 
@@ -1329,19 +1329,6 @@ Access permissions for database "test"
     
 
 
-    
-      -k, --unixsocket path
-      
-      
-      Specifies the Unix-domain socket on which the
-      postmaster is running.
-      Without this option, the socket is created in /tmp
-      based on the port number.
-      
-      
-    
-
-
     
       -H, --html
       
index 7a701f216d507544313d79a47739ad38acbe8ea4..28151190a731c59e86612ab3c4e7ce0138c82322 100644 (file)
@@ -1,5 +1,5 @@
 
 
@@ -136,18 +136,6 @@ Postgres documentation
       
      
 
-    
-      -k, --unixsocket path
-      
-      
-      Specifies the Unix-domain socket on which the
-      postmaster is running.
-      Without this option, the socket is created in /tmp
-      based on the port number.
-      
-      
-    
-
      
       -U username
       --username username
index c6b645b15ba2bcd006e06941d6c218193ff48be4..b9d4973013842bdeb633825eb193b058d4f963fb 100644 (file)
@@ -11,7 +11,7 @@
  *
  *
  * 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
  *
@@ -1334,8 +1334,8 @@ get_host_port(void)
        {
            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);
index ffe071a6655f7147ee2f059521b8abbb906e3b7b..8fceb26c8e24645bd2c010947e508f1d19b86157 100644 (file)
@@ -99,9 +99,8 @@ typedef struct _restoreOptions {
 
    int         useDB;
    char        *dbname;
-   char        *pghost;
    char        *pgport;
-   char        *pgunixsocket;
+   char        *pghost;
    int         ignoreVersion;
    int         requirePassword;
 
@@ -123,7 +122,6 @@ PGconn* ConnectDatabase(Archive *AH,
        const char*     dbname,
        const char* pghost,
        const char* pgport,
-       const char* pgunixsocket,
        const int   reqPwd,
        const int   ignoreVersion);
 
index 085a2eb3297189f6596757cff9f9beb1f4d6d1e8..d8a969b41e0279623081d0869737c869be389845 100644 (file)
@@ -131,9 +131,8 @@ void RestoreArchive(Archive* AHX, RestoreOptions *ropt)
        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...
index a938f5e3395bb15b6ef1c6a467904477fe21a743..2c7291e6c6917f678c6711c2ecac34c532546412 100644 (file)
@@ -187,7 +187,6 @@ typedef struct _archiveHandle {
    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 */
index 082edd582417ccf190223934becede5cc8f0df87..72189eb29fbe7433b338cf0a37b465bdc3721f0f 100644 (file)
@@ -273,7 +273,6 @@ PGconn* ConnectDatabase(Archive *AHX,
        const char*     dbname,
        const char*     pghost,
        const char*     pgport,
-       const char*     pgunixsocket,
        const int       reqPwd,
        const int       ignoreVersion)
 {
@@ -308,15 +307,6 @@ PGconn* ConnectDatabase(Archive *AHX,
    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);
 
index 738425a3ebea56bd83def06607b54c428996c2a7..a7c1ca9e8a490bd6d883026959e92d67e7f429ee 100644 (file)
@@ -22,7 +22,7 @@
  *
  *
  * 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 $
  *
  * Modifications - 6/10/96 - [email protected] - version 1.13.dhb
  *
@@ -200,7 +200,6 @@ help(const char *progname)
        "  -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"
@@ -227,7 +226,6 @@ help(const char *progname)
        "  -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"
@@ -631,7 +629,6 @@ main(int argc, char **argv)
    const char *dbname = NULL;
    const char *pghost = NULL;
    const char *pgport = NULL;
-   const char *pgunixsocket = NULL;
    char       *tablename = NULL;
    bool        oids = false;
    TableInfo  *tblinfo;
@@ -661,7 +658,6 @@ main(int argc, char **argv)
        {"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'},
@@ -756,10 +752,6 @@ main(int argc, char **argv)
                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;
@@ -956,8 +948,7 @@ main(int argc, char **argv)
    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
index cafb7e9df602a5e8b1d6c86a15942c1f57a538ca..458482ed5112d2ed093c7a6a44b1cb4afda685e2 100644 (file)
@@ -101,7 +101,6 @@ struct option cmdopts[] = {
                { "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' },
@@ -133,9 +132,9 @@ int main(int argc, char **argv)
    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)
@@ -171,10 +170,6 @@ int main(int argc, char **argv)
            case 'i':
                opts->ignoreVersion = 1;
                break;
-           case 'k':
-               if (strlen(optarg) != 0)
-                   opts->pgunixsocket = strdup(optarg);
-               break;
            case 'N':
                opts->origOrder = 1;
                break;
index 65c05a4ac912cef0a5ac52d3031262ba7807a132..0d3a1f3a899b3dec4c5374ec0ac93c5f9416abfd 100644 (file)
@@ -3,7 +3,7 @@
  *
  * 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"
@@ -1202,7 +1202,6 @@ do_connect(const char *new_dbname, const char *new_user)
    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) */
@@ -1232,7 +1231,6 @@ do_connect(const char *new_dbname, const char *new_user)
    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);
 
@@ -1309,7 +1307,6 @@ do_connect(const char *new_dbname, const char *new_user)
    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));
index da0542df5937afa147c7390d9ef67c1bafc80532..658854fc08a23c6b39ac9f5ec1af5596a74294b3 100644 (file)
@@ -3,7 +3,7 @@
  *
  * 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"
@@ -329,7 +329,6 @@ PSQLexec(const char *query)
            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;
@@ -509,7 +508,6 @@ SendQuery(const char *query)
                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;
index b9ee9caa67aa3fc1a156de9acc8fa1956b75be77..21bcdcafa7810c955aa42e0fdc6a97fdd7c333d5 100644 (file)
@@ -3,7 +3,7 @@
  *
  * 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"
@@ -103,16 +103,6 @@ usage(void)
    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)");
index d29bc12ddb97e2d8662db53639aa1210c3938149..4788c2ce128df94dc4e39dcd9fa52b77d9b0833d 100644 (file)
@@ -3,7 +3,7 @@
  *
  * 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"
@@ -190,11 +190,6 @@ get_prompt(promptStatus_t status)
                    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)
index 9b0e60f0a3503f02aef614a3d8a36deac4a6ee9e..46e476a2ae013e8470b40976f834b6d7ab20b517 100644 (file)
@@ -3,7 +3,7 @@
  *
  * 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"
 
@@ -65,7 +65,6 @@ struct adhoc_opts
    char       *dbname;
    char       *host;
    char       *port;
-   char       *unixsocket;
    char       *username;
    enum _actions action;
    char       *action_string;
@@ -162,7 +161,6 @@ main(int argc, char *argv[])
    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);
@@ -208,7 +206,6 @@ main(int argc, char *argv[])
    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
@@ -323,7 +320,6 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
        {"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'},
@@ -357,14 +353,14 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
    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)
@@ -410,9 +406,6 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
            case 'l':
                options->action = ACT_LIST_DB;
                break;
-           case 'k':
-               options->unixsocket = optarg;
-               break;
            case 'n':
                options->no_readline = true;
                break;
index 213913ba890bb60024e6246b9adb274307b27570..e506af5885cd0dec75b397ac36b99caeedb72409 100644 (file)
@@ -11,7 +11,7 @@
 #
 #
 # 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 $
 #
 #-------------------------------------------------------------------------
 
@@ -50,15 +50,6 @@ do
         --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;;
@@ -123,7 +114,6 @@ if [ "$usage" ]; then
    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"
index c22dcba652f0a5f76451da25d55b1bc423338622..3fc0a1b02fa4e06302b2e34d56fda8f537371385 100644 (file)
@@ -8,7 +8,7 @@
 #
 #
 # 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 $
 #
 #-------------------------------------------------------------------------
 
@@ -65,15 +65,6 @@ do
         --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;;
@@ -135,7 +126,6 @@ if [ "$usage" ]; then
    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"
index 198e4b81cfa252d9edc2d4082b24a9c7ecc6d14b..e3859eb2a7537ee91a09ece7b368cdd0bf2b6f91 100644 (file)
@@ -8,7 +8,7 @@
 #
 #
 # 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.
 #
@@ -63,15 +63,6 @@ do
         --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)
@@ -144,7 +135,6 @@ if [ "$usage" ]; then
    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"
index 586b62ac7f79bfd4e02f57b7795ec3ad134e5418..35bb08a71afb341dcc255eb7c376eec4e980b5ff 100644 (file)
@@ -10,7 +10,7 @@
 #
 #
 # 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 $
 #
 #-------------------------------------------------------------------------
 
@@ -59,15 +59,6 @@ do
         --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;;
@@ -112,7 +103,6 @@ if [ "$usage" ]; then
    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"
index 46856e4241da3e23cd5d3ca40e32af050ea0c039..023ae4fc996e5ffe2358dded9df4b411d178c8e1 100644 (file)
@@ -8,7 +8,7 @@
 #
 #
 # 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 $
 #
 #-------------------------------------------------------------------------
 
@@ -65,15 +65,6 @@ do
         --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;;
@@ -122,7 +113,6 @@ if [ "$usage" ]; then
    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"
index 4aa858124b29969bdeca1ab749a65e15ae619fbc..e7be5dc867ac3120ac9fe4489d0c4ee3ea71bf5f 100644 (file)
@@ -8,7 +8,7 @@
 #
 #
 # 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.
 #
@@ -59,15 +59,6 @@ do
         --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)
@@ -114,7 +105,6 @@ if [ "$usage" ]; then
    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"
index fb1db8bfe67c0be3870e102119810047441c0261..0981f31e72c8e6b169431ecb76d43bdddb396d5a 100644 (file)
@@ -11,7 +11,7 @@
 #
 #
 # 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 $
 #
 #-------------------------------------------------------------------------
 
@@ -52,15 +52,6 @@ do
         --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;;
@@ -130,7 +121,6 @@ if [ "$usage" ]; then
         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"
index b0447285d48b115744e2b181f769cde88e13723e..9c720c12a1c2fd8dd0d8850534749c0e4ad0d7e6 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * 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 $
  *
  *-------------------------------------------------------------------------
  */
@@ -331,6 +331,25 @@ PQconnectStart(const char *conninfo)
     */
    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
     * ----------
@@ -443,13 +462,25 @@ PQsetdbLogin(const char *pghost, const char *pgport, const char *pgoptions,
    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)
    {
@@ -778,7 +809,7 @@ connectDBStart(PGconn *conn)
        {
            printfPQExpBuffer(&conn->errorMessage,
                              "connectDBStart() -- "
-                        "invalid host address: %s\n", conn->pghostaddr);
+                             "invalid host address: %s\n", conn->pghostaddr);
            goto connect_errReturn;
        }
 
index a7c6acb9524b154dd79da67462ae9c3a21029dae..5c1cb86ffe2ddf554de9a58c9974f6ea1701df33 100644 (file)
@@ -12,7 +12,7 @@
  * 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 $
  *
  *-------------------------------------------------------------------------
  */
@@ -203,8 +203,8 @@ struct pg_conn
                                 * 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 */