Thread: PQsetdbLogin() and PQconnectdb() fail on HPUX11i 64 bits with empty servername

PQsetdbLogin() and PQconnectdb() fail on HPUX11i 64 bits with empty servername

From
"Jan van der Weijde"
Date:
Hello all,
 
I'm using PQsetdbLogin() or PQconnectdb() to connect to a local server on an 64bits HP system with O/S HPUX11i. The PostgreSQL version is 8.1.4
According to the documentation I can leave out the host specification:
 
host:
Name of host to connect to. 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 behavior when host is not specified is to connect to a Unix-domain socket in /tmp (or whatever socket directory was specified when PostgreSQL was built). On machines without Unix-domain sockets, the default is to connect to localhost.
 
However when I do that, the client givers error message:
 
could not connect to server:
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
 
while the postmaster server log the first time:
LOG:  getsockname() failed: Invalid argument
and any subsequent time: 
LOG:  incomplete startup packet
 
No other socket location was specified when PostgreSQL was built, so both the client and the server should use /tmp
 
When I compile the client API as 32 bits code, the error does not occur.
When I do specify localhost or an actual server name  both connect functions succeed.
 
Can anyone help me?
 
Thank you,
Jan van der Weijde
 
 
"Jan van der Weijde" <Jan.van.der.Weijde@attachmate.com> writes:
> I'm using PQsetdbLogin() or PQconnectdb() to connect to a local server
> on an 64bits HP system with O/S HPUX11i. The PostgreSQL version is 8.1.4
> ...
> When I compile the client API as 32 bits code, the error does not occur.
> When I do specify localhost or an actual server name  both connect
> functions succeed.

What exactly do you mean by "HPUX11i" --- it's not even clear whether
you are talking about a PA-RISC or an Intel platform here?  What
compiler are you using, and with what options?  (The output of pg_config
would be helpful.)

FWIW, I checked PG 8.1 before release on 11.23, PA-RISC and IA64 both,
and it passed regression tests in 64-bit builds, so it's not completely
broken on that platform.  The regression tests do use local connections
by default.
        regards, tom lane


"Jan van der Weijde" <Jan.van.der.Weijde@attachmate.com> writes:
> I'm using PQsetdbLogin() or PQconnectdb() to connect to a local server
> on an 64bits HP system with O/S HPUX11i. The PostgreSQL version is 8.1.4
> According to the documentation I can leave out the host specification:
> However when I do that, the client givers error message:
> could not connect to server:
> Is the server running locally and accepting
> connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

I tried to reproduce this on HP's testdrive machines, without success:
it seems to work fine.  "64bits HP system with O/S HPUX11i" is pretty
darn vague, considering that HP supports this OS on two different
architectures and there are multiple subversions of it, but on the whole
I'd bet on a compiler problem.  Is your compiler fully up-to-date with
HP's patches?
        regards, tom lane