Thread: psql inability to select a socket

psql inability to select a socket

From
alex avriette
Date:
As some of you know, OpenBSD 3.3 chroots apache. So I'm running the 
postmaster with its socket in /var/www/tmp. However, psql doesn't allow 
me to specify a socket to point at:

Connection options:  -h HOSTNAME     specify database server host (default: local socket)  -p PORT         specify
databaseserver port (default: 5432)  -U NAME         specify database user name (default: alex)  -W              prompt
forpassword (should happen automatically)
 

Could this be included in the next version?

Thanks,
alex



Re: psql inability to select a socket

From
Doug McNaught
Date:
alex avriette <alex@posixnap.net> writes:

> As some of you know, OpenBSD 3.3 chroots apache. So I'm running the
> postmaster with its socket in /var/www/tmp. However, psql doesn't
> allow me to specify a socket to point at:
> 
> Connection options:
>    -h HOSTNAME     specify database server host (default: local socket)
>    -p PORT         specify database server port (default: 5432)
>    -U NAME         specify database user name (default: alex)
>    -W              prompt for password (should happen automatically)
> 
> Could this be included in the next version?

See the 'unix_socket_directory' setting in postgresql.conf.

-Doug



Re: psql inability to select a socket

From
"Jeroen T. Vermeulen"
Date:
On Sun, May 11, 2003 at 01:16:45PM -0400, alex avriette wrote:
> As some of you know, OpenBSD 3.3 chroots apache. So I'm running the 
> postmaster with its socket in /var/www/tmp. However, psql doesn't allow 
> me to specify a socket to point at:
> 
> Connection options:
>   -h HOSTNAME     specify database server host (default: local socket)

AFAIK there's a special case for "hostnames" with slashes; those get
interpreted as a path to a local socket.  Try setting PGHOST to 
/var/www/tmp before you start psql, for instance.


Jeroen



Re: psql inability to select a socket

From
alex avriette
Date:
> AFAIK there's a special case for "hostnames" with slashes; those get
> interpreted as a path to a local socket.  Try setting PGHOST to
> /var/www/tmp before you start psql, for instance.

Ah! Jeroen this is wonderful. Thank you.

stink# setenv PGHOST /var/www/tmp
stink# /var/postgresql/bin/psql -U snort snort
Welcome to psql 7.3.2, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms       \h for help with SQL commands       \? for help on internal slash
commands      \g or terminate with semicolon to execute query       \q to quit
 

snort=>

My mistake, I didn't RT the FM:
       --host hostname              Specifies the host name of the machine on which the              postmaster is
running.If host begins with a slash,              it  is  used  as  the directory for the Unix-domain
socket.

Would it be overly verbose to mention the various PGHOST, PGDATA, 
PGUSER, etc variables in the output of
`psql --help`?

Alex