Repair residual sillinesses from UUNET virtual host/socket path patch.
authorTom Lane
Thu, 30 Nov 2000 23:20:51 +0000 (23:20 +0000)
committerTom Lane
Thu, 30 Nov 2000 23:20:51 +0000 (23:20 +0000)
I hope all the dust has settled out now ...

doc/src/sgml/environ.sgml
doc/src/sgml/libpq++.sgml
doc/src/sgml/libpq.sgml
doc/src/sgml/ref/pg_dump.sgml
doc/src/sgml/ref/pg_dumpall.sgml
doc/src/sgml/ref/pg_restore.sgml
doc/src/sgml/ref/postmaster.sgml
doc/src/sgml/runtime.sgml
doc/src/sgml/start.sgml
src/backend/postmaster/postmaster.c
src/interfaces/libpq/fe-connect.c

index 830502a696db11af2e53f6c9e900d3c87ef37212..dc5741a95d8003bb95fb4ef032d8cbc72044583d 100644 (file)
@@ -47,17 +47,16 @@ $ export PATH
 
 
 
-
-If your site administrator has not set things up in the default  way, 
-you may have some more work to do.  For example, if the database server
-machine is a remote machine, you will need to set the
-PGHOST environment variable to the name of the
-database server machine.   The  environment  variable
-PGPORT or PGUNIXSOCKET may also have
-to be set.  The bottom line is this: if you try to start an application 
-program  and  it  complains that it cannot connect to the
-postmaster, you should immediately consult
-your site administrator to make sure that your environment is properly
-set up. 
+If your site administrator has not set things up in the
+default  way,  you may have some more work to do.  For example, if the database
+ server machine is a remote machine, you
+will need to set the PGHOST environment variable to the name
+of the database server machine.   The  environment  variable
+PGPORT may also have to be set.  The bottom line is this: if
+you try to start an application  program  and  it  complains
+that it cannot connect to the postmaster,
+ you should immediately consult your site administrator to make sure that your
+environment is properly set up.
+
 
 
index 43cf4ad1d504aee37c659214ed948f7689a9463a..eb71a508ed0f415b89bac120ec064251cb0103e9 100644 (file)
@@ -1,5 +1,5 @@
 
 
  
@@ -80,22 +80,16 @@ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/libpq++.sgml,v 1.19 2000/11/22 01:41:
       
        
    PGHOST sets the default server name.
-        If it begins with a slash, it is used
-        as the directory for the unix domain socket.
+        If this begins with a slash, it specifies Unix-domain communication
+        rather than TCP/IP communication; the value is the name of the
+   directory in which the socket file is stored (default "/tmp").
        
       
       
        
-   PGPORT  sets the default port or local Unix domain socket
-   file extension for communicating with the Postgres
-   backend.
-       
-      
-      
-       
-   PGUNIXSOCKET  sets the Unix domain socket
-   directory for communicating with the Postgres
-   backend.
+   PGPORT sets the default TCP port number or Unix-domain
+   socket file extension for communicating with the
+   Postgres backend.
        
       
       
index dc8d539f0d81a7140b81d67e665be255e3f9b618..8366f193848665117a67aa6949cf906a21e289fa 100644 (file)
@@ -1,5 +1,5 @@
 
 
  
@@ -88,9 +88,11 @@ PGconn *PQconnectdb(const char *conninfo)
      
      
       Name of host to connect to. 
-      Using this parameter causes a hostname look-up.  See hostaddr.
-      If it begins with a slash, it is used
-      as the directory for the unix domain socket.
+      If this begins with a slash, it specifies Unix-domain communication
+      rather than TCP/IP communication; the value is the name of the
+      directory in which the socket file is stored.
+      The default is to connect to a Unix-domain socket in
+      /tmp.
      
      
     
@@ -118,7 +120,7 @@ PGconn *PQconnectdb(const char *conninfo)
       machine at hostaddr.
      
      
-      Without both a host name and host address, libpq will connect using a
+      Without either a host name or host address, libpq will connect using a
       local Unix domain socket.
      
      
@@ -1820,14 +1822,16 @@ application programs.
 
 
 PGHOST sets the default server name.
-If it beings with a slash, it is used as the directory for the unix domain
-socket.
+If this begins with a slash, it specifies Unix-domain communication
+rather than TCP/IP communication; the value is the name of the
+directory in which the socket file is stored (default "/tmp").
 
 
 
 
-PGPORT sets the default port for communicating with
-the Postgres backend.
+PGPORT sets the default TCP port number or Unix-domain
+socket file extension for communicating with the
+Postgres backend.
 
 
 
index 925e5c72cf8c12014518f0b42bf18e435b7ac7fc..465043a9a4113dd33b9065e3ca49eda1f135ac44 100644 (file)
@@ -1,5 +1,5 @@
 
 
@@ -371,8 +371,9 @@ pg_dump [ -h host ]
      
       
 Connection to database 'template1' failed.
-connectDB() failed: Is the postmaster running and accepting connections
-            at 'UNIX Socket' on port 'port'?
+connectDBStart() -- connect() failed: No such file or directory
+        Is the postmaster running locally
+        and accepting connections on Unix socket '/tmp/.s.PGSQL.5432'?
        
       
        
index 907dcbb3b2d931c611cf6b27f0f460e7621c0f51..ac61de92b9677039f78640b46ebfa5ccf2e614ad 100644 (file)
@@ -1,5 +1,5 @@
 
 
@@ -192,7 +192,9 @@ pg_dumpall [ -h host ] [ -p 
      
       
 Connection to database 'template1' failed.
-connectDB() failed: Is the postmaster running and accepting connections at 'UNIX Socket' on port 'port'?
+connectDBStart() -- connect() failed: No such file or directory
+        Is the postmaster running locally
+        and accepting connections on Unix socket '/tmp/.s.PGSQL.5432'?
        
       
        
index 8af8226d9485ca8166b5b604fdeccaa05e225ac6..f04a6a62c894fba00e19ba81703b3addd1198895 100644 (file)
@@ -345,8 +345,9 @@ pg_restore [ archive-file  ]
      
       
 Connection to database 'template1' failed.
-connectDB() failed: Is the postmaster running and accepting connections
-            at 'UNIX Socket' on port 'port'?
+connectDBStart() -- connect() failed: No such file or directory
+        Is the postmaster running locally
+        and accepting connections on Unix socket '/tmp/.s.PGSQL.5432'?
        
       
        
index 5bf5e4cb92b205ce12839b9f6b70c7124843427d..8168ada6f4eaba2e409e96b57c5342d804fb2d95 100644 (file)
@@ -1,11 +1,11 @@
 
 
 
  
-  2000-11-12
+  2000-11-30
  
 
  
@@ -30,7 +30,7 @@ Postgres documentation
    -F
    -h hostname
    -i
-   -k filename
+   -k directory
    -l
    -N max-connections
    -o extra-options
@@ -70,10 +70,10 @@ Postgres documentation
    starts it needs to know the location of the database cluster files
    (data area).  This is done with the
     invocation option or the PGDATA
-   environment variable, there is no default.  More than one
+   environment variable; there is no default.  More than one
    postmaster process can run on a system at one time, as long as they
-   use different data areas and different port numbers (see below).  A
-   data area is created with 
+   use different data areas and different communication ports (see below).
+   data area is created with 
    endterm="app-initdb-title">.
   
 
@@ -165,10 +165,8 @@ Postgres documentation
        
    Specifies the TCP/IP hostname or address on which the
    postmaster is to listen for
-   connections from client applications.  Defaults to the value
-   of the PGHOST environment variable, or if
-   PGHOST is not set, it defaults to listening on
-   all configured addresses (including localhost).
+   connections from client applications.  Defaults to
+   listening on all configured addresses (including localhost).
        
       
      
@@ -185,15 +183,13 @@ Postgres documentation
      
 
      
-      -k filename
+      -k directoryname
       
        
-   Specifies the directory for Unix domain socket on which the
+   Specifies the directory of the Unix-domain socket on which the
    postmaster is to listen for
-   connections from client applications.  Defaults to the value
-   of the PGUNIXSOCKET environment variable, or if
-   PGUNIXSOCKET is not set, then defaults to a
-   file in /tmp.
+   connections from client applications.  The default is normally
+   /tmp, but can be changed at build time.
        
       
      
index 3447cc694f5d96229c89b6af80c462125d51e67b..bb65624859a2bd3c40fe5652a7b709422e8b941a 100644 (file)
@@ -1,5 +1,5 @@
 
 
 
@@ -347,7 +347,7 @@ IpcSemaphoreCreate: semget(key=5440026, num=16, 01600) failed: No space left on
     
 
 connectDB() -- connect() failed: Connection refused
-Is the postmaster running (with -i) at 'server.joe.com' and accepting connections on TCP/IP port '5432'?
+Is the postmaster running (with -i) at 'server.joe.com' and accepting connections on TCP/IP port 5432?
 
      This is the generic I couldn't find a server to talk
      to failure. It looks like the above when TCP/IP
@@ -361,7 +361,7 @@ Is the postmaster running (with -i) at 'server.joe.com' and accepting connection
      Unix-socket communication to a local postmaster:
 
 connectDB() -- connect() failed: No such file or directory
-Is the postmaster running at 'localhost' and accepting connections on Unix socket '5432'?
+Is the postmaster running locally and accepting connections on Unix socket '/tmp/.s.PGSQL.5432'?
 
     
 
@@ -1082,15 +1082,13 @@ env PGOPTIONS='-c geqo=off' psql
      
 
      
-      UNIXSOCKET (string)
+      UNIX_SOCKET_DIRECTORY (string)
       
        
-   Specifies the directory of the Unix domain socket on which the
+   Specifies the directory of the Unix-domain socket on which the
    postmaster is to listen for
-   connections from client applications.  Defaults to the value
-   of the PGUNIXSOCKET environment variable, or if
-   PGUNIXSOCKET is not set, then defaults to 
-        /tmp.
+   connections from client applications.  The default is normally
+   /tmp, but can be changed at build time.
        
       
      
@@ -1151,23 +1149,8 @@ env PGOPTIONS='-c geqo=off' psql
        
    Specifies the TCP/IP hostname or address on which the
    postmaster is to listen for
-   connections from client applications.  Defaults to the value
-   of the PGHOST environment variable, or if
-   PGHOST is not set, it defaults to listening on
-   all configured addresses (including localhost).
-       
-       
-   If you use a hostname do not try to run multiple instances of
-   postmaster on the same IP address
-   but different ports.  Doing so will result in them attempting
-   (incorrectly) to use the same shared memory segments.  Also,
-   if you use a hostname, all of the host's IP addresses on which
-   postmaster instances are listening
-   must be distinct in the two last octets.
-       
-       
-   If you do not use this option, then each instance must listen
-   on a different port.
+   connections from client applications.  Defaults to
+   listening on all configured addresses (including localhost).
        
       
      
@@ -1220,6 +1203,11 @@ env PGOPTIONS='-c geqo=off' psql
         tcpip_socket = on
         
        
+       
+        -k x
+        unix_socket_directory = x
+        
+       
        
         -l
         ssl = on
index 3b484f50f95e94aab31988a562810f0074247a9b..12a413d7ec3329d8b69a5c35988d92a88becc033 100644 (file)
@@ -1,5 +1,5 @@
 
 
  
@@ -110,7 +110,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/start.sgml,v 1.14 2000/11/13 15:18:07 momji
     will need to set the PGHOST environment
     variable to the name
     of the database server machine.   The  environment  variable
-    PGPORT or PGUNIXSOCKET may also have to be set.
+    PGPORT may also have to be set.
     The bottom line is this: if
     you try to start an application  program  and  it  complains
     that it cannot connect to the postmaster,
@@ -154,18 +154,18 @@ $Header: /cvsroot/pgsql/doc/src/sgml/start.sgml,v 1.14 2000/11/13 15:18:07 momji
 
     
 % psql template1
-Connection to database 'postgres' failed.
-connectDB() failed: Is the postmaster running and accepting connections
-    at 'UNIX Socket' on port '5432'?
+psql: connectDBStart() -- connect() failed: No such file or directory
+        Is the postmaster running locally
+        and accepting connections on Unix socket '/tmp/.s.PGSQL.5432'?
     
 
     or
 
     
 % psql -h localhost template1
-Connection to database 'postgres' failed.
-connectDB() failed: Is the postmaster running and accepting TCP/IP
-    (with -i) connections at 'localhost' on port '5432'?
+psql: PQconnectPoll() -- connect() failed: Connection refused
+        Is the postmaster running (with -i) at 'localhost'
+        and accepting connections on TCP/IP port 5432?
     
 
     it is usually because
index 618228364ce711cd7a6c2572a48bda66d601d11c..4def9996f14e3458642995e41c13844391ae2b57 100644 (file)
@@ -11,7 +11,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.196 2000/11/29 22:04:04 tgl Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.197 2000/11/30 23:20:51 tgl Exp $
  *
  * NOTES
  *
@@ -432,7 +432,6 @@ PostmasterMain(int argc, char *argv[])
                NetServer = true;
                break;
            case 'k':
-               /* Set PGUNIXSOCKET by hand. */
                UnixSocketDir = optarg;
                break;
 #ifdef USE_SSL
@@ -732,7 +731,7 @@ usage(const char *progname)
    printf("  -F              turn fsync off\n");
    printf("  -h HOSTNAME     host name or IP address to listen on\n");
    printf("  -i              enable TCP/IP connections\n");
-   printf("  -k FILENAME     Unix domain socket location\n");
+   printf("  -k DIRECTORY    Unix-domain socket location\n");
 #ifdef USE_SSL
    printf("  -l              enable SSL connections\n");
 #endif
index b2a4c2c0dc41496d408743e44fc6ed7c89e9190a..173ab6c659e97180d1b6101fbe28ea6ae3757ee1 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.151 2000/11/30 18:32:52 petere Exp $
+ *   $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.152 2000/11/30 23:20:51 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -741,6 +741,36 @@ connectNoDelay(PGconn *conn)
 }
 
 
+/* ----------
+ * connectFailureMessage -
+ * create a friendly error message on connection failure.
+ * ----------
+ */
+static void
+connectFailureMessage(PGconn *conn, const char *caller, int errorno)
+{
+#ifdef HAVE_UNIX_SOCKETS
+   if (conn->raddr.sa.sa_family == AF_UNIX)
+       printfPQExpBuffer(&conn->errorMessage,
+                         "%s -- connect() failed: %s\n"
+                         "\tIs the postmaster running locally\n"
+                         "\tand accepting connections on Unix socket '%s'?\n",
+                         caller,
+                         strerror(errorno),
+                         conn->raddr.un.sun_path);
+   else
+#endif
+       printfPQExpBuffer(&conn->errorMessage,
+                         "%s -- connect() failed: %s\n"
+                         "\tIs the postmaster running (with -i) at '%s'\n"
+                         "\tand accepting connections on TCP/IP port %s?\n",
+                         caller,
+                         strerror(errorno),
+                         conn->pghost ? conn->pghost : "localhost",
+                         conn->pgport);
+}
+
+
 /* ----------
  * connectDBStart -
  * Start to make a connection to the backend so it is ready to receive
@@ -911,17 +941,7 @@ connectDBStart(PGconn *conn)
        else
        {
            /* Something's gone wrong */
-           printfPQExpBuffer(&conn->errorMessage,
-                             "connectDBStart() -- connect() failed: %s\n"
-                             "\tIs the postmaster running%s at '%s'\n"
-                             "\tand accepting connections on %s '%s'?\n",
-                             strerror(errno),
-                             (family == AF_INET) ? " (with -i)" : "",
-                             conn->pghost ? conn->pghost : "localhost",
-                             (family == AF_INET) ?
-                             "TCP/IP port" : "Unix socket",
-                             (family == AF_UNIX && conn->pgunixsocket) ?
-                             conn->pgunixsocket : conn->pgport);
+           connectFailureMessage(conn, "connectDBStart()", errno);
            goto connect_errReturn;
        }
    }
@@ -1213,17 +1233,7 @@ keep_going:                      /* We will come back to here until there
                     * see connect failures at this point, so provide a
                     * friendly error message.
                     */
-                   printfPQExpBuffer(&conn->errorMessage,
-                             "PQconnectPoll() -- connect() failed: %s\n"
-                               "\tIs the postmaster running%s at '%s'\n"
-                            "\tand accepting connections on %s '%s'?\n",
-                                     strerror(optval),
-                                     (conn->raddr.sa.sa_family == AF_INET) ? " (with -i)" : "",
-                              conn->pghost ? conn->pghost : "localhost",
-                                 (conn->raddr.sa.sa_family == AF_INET) ?
-                                     "TCP/IP port" : "Unix socket",
-                             (conn->raddr.sa.sa_family == AF_UNIX && conn->pgunixsocket) ?
-                                     conn->pgunixsocket : conn->pgport);
+                   connectFailureMessage(conn, "PQconnectPoll()", optval);
                    goto error_return;
                }