Re: unix_socket_directory not fully recognized by pg_ctl? - Mailing list pgsql-general

From Oliver Elphick
Subject Re: unix_socket_directory not fully recognized by pg_ctl?
Date
Msg-id 1069194696.16543.1003.camel@linda.lfix.co.uk
Whole thread Raw
In response to unix_socket_directory not fully recognized by pg_ctl?  ("Szűcs Gábor" <surrano@mailbox.hu>)
List pgsql-general
On Sun, 2003-11-16 at 21:01, Szűcs Gábor wrote:
> Dear Gurus,
>
> I have a similar problem as discussed in
> http://archives.postgresql.org/pgsql-novice/2003-06/msg00321.php
>
> This probably should go to pgsql-novice too, but I'm not a member of that
> list so please forgive my lazyness.
>
> I use Debian Woody Linux and installed postgres (v7.2.1), but I needed a
> newer version, so decided to try 7.4RC2 (which is not in the news yet, as I
> checked today). It compiled and installed, and I could run the backend.
> However, PHP could not run, since it searched for the socket in
> /var/run/postgresql.

The debian packages put the socket in /var/run/postgresql and therefore
everything that links to libpq.so on Debian will look for it there.

> I found the unix_socket_directory option in postgresql.conf and set it to
> /var/run/postgresql and restarted the server with
>
>   bin/pg_ctl start -w -D data -l data/postgres.log
>
> The socket file and socket lockfile was created in /var/run/postgresql
> -- it's ok, but pg_ctl hung, and after quite some time it exited with
> "pg_ctl: postmaster does not start"
>
> However; I can connect the server with PHP's pg_connect(), or psql -- but
> psql only works through TCP/IP (i.e. -h localhost). If run locally, it
> searches for socket in /tmp. Using
>
>   psql -h /var/run/postgresql
>
> did work. My questions are:
> What causes pg_ctl's strange behaviour?

That's the way it is built by default.  Since you built it rather than
installing it from a package, that's the behaviour you got.

> Is this the only way to tell this to psql?

You can say "psql -h /var/run/postgresql" to specify where the Unix
socket is.  If the hostname begins with a slash, it is taken as the
socket location rather than a network address.

> Is there a compile-time configuration parameter? (could not find it)

#define DEFAULT_PGSOCKET_DIR  "/var/run/postgresql"
in src/include/pg_config_manual.h

> Is there a psqlrc setting for this?

No - that is too late.  You need the location of the socket before you
start the connection.

> Is there a complete description for psqlrc? (could not find it)

In the man page for psql.  It contains commands (that would be valid on
the command line) to run as psql starts up.


You can get Debian packages of 7.4 built for woody from
http://people.debian.org/~elphick/debian

This will fix the incompatibilty problems you are having.

In /etc/apt/sources.list:
deb http://people.debian.org/~elphick/debian stable main

--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight, UK                             http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "A Song for the sabbath day. It is a good thing to
      give thanks unto the LORD, and to sing praises unto
      thy name, O most High."   Psalms 92:1


pgsql-general by date:

Previous
From: Thomas Kellerer
Date:
Subject: Re: SQL text of view
Next
From: Oliver Elphick
Date:
Subject: Re: AUTOCOMMIT didn't work...