psql inability to select a socket

Started by alex avrietteover 22 years ago4 messages
#1alex avriette
alex@posixnap.net

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?

Thanks,
alex

#2Doug McNaught
doug@mcnaught.org
In reply to: alex avriette (#1)
Re: psql inability to select a socket

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

In reply to: alex avriette (#1)
Re: psql inability to select a socket

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

#4alex avriette
alex@posixnap.net
In reply to: Jeroen T. Vermeulen (#3)
Re: psql inability to select a 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.

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