Postgresql: Difference between revisions

From Elvanör's Technical Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 8: Line 8:


* By default on Gentoo the socket file (on /var/run/postgresql directory) allows only reading (and writing) to the postgres user. This means that other users (like apache via mod_php) cannot connect to the DB via the UNIX socket. This implies that to make phppgadmin works (for instance) you have to explicitely write "localhost" as the server name in the configuration file.
* By default on Gentoo the socket file (on /var/run/postgresql directory) allows only reading (and writing) to the postgres user. This means that other users (like apache via mod_php) cannot connect to the DB via the UNIX socket. This implies that to make phppgadmin works (for instance) you have to explicitely write "localhost" as the server name in the configuration file.
= Management =
* Use the following command to copy a database to another one in the same server (the source DB must NOT be used):
create database newdb template olddb;
This is a Postgresql command, not standard SQL.

Revision as of 15:48, 1 May 2009

Installation on Gentoo

  • The ebuilds that should be used are dev-db/postgresql-server-*, since they are newer and modularized instead of monolithic (old ebuilds are dev-db/postgresql).
  • There can be a problem with the postgres USE flag of php. It can pull in libpq which would block the modularized postgresql-server package. The solution is to build postgresql-server first (removing libpq if already installed), then rebuild PHP. This will probably be done automatically once postgresql-server is stabilized.
  • Similarly you need a version of psycopg (Python driver for Postgresql) that does not depend on libpq (2.0.10 is fine but unstable at the time of this writing).

Initial configuration

  • By default on Gentoo the socket file (on /var/run/postgresql directory) allows only reading (and writing) to the postgres user. This means that other users (like apache via mod_php) cannot connect to the DB via the UNIX socket. This implies that to make phppgadmin works (for instance) you have to explicitely write "localhost" as the server name in the configuration file.

Management

  • Use the following command to copy a database to another one in the same server (the source DB must NOT be used):
create database newdb template olddb;

This is a Postgresql command, not standard SQL.