I am trying to configure a PostgreSQL database. Postgres is installed and running, but the PID file that it creates by default is different from what psycopg2 wants (which is /var/run/postgresql/.s.PGSQL.5432).

When I change /etc/postgresql/8.4/main/postgresql.conf to reflect this file, it fails silently and doesn't create the file. I tried a different file name that did not begin with a dot and it worked.

Is there a way to force Postgres to create this file, or to change the path that psycopg2 looks at to connect?


  • 2
    What you are describing the is not a PID file, but a Unix domain socket file. Also, if something fails, show the error message. If you change a configuration file, say what you changed. – Peter Eisentraut Aug 25 '11 at 10:07

You can set unix_socket_directory in your postgresql.conf to force your server to put the socket in /var/run/postgresql. I'm not positive where psycopg2 picks up the default path from, I wouldn't be surprised if it were compiled in based on the default.

  • That's fine, but it doesn't solve my problem. Postgres is responding to most changes to PID file parameters, it just won't create a file that begins with a dot, which is what psycopg2 looks for. I suppose I supplied an inappropriate title. It should have been "How can I change the PID file that psycopg2 looks for?" but I believe that is moot because it has to be done by postgres. – user699397 Aug 25 '11 at 4:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.