1

PostgreSQL seems to have an environment file that allows settings environment variables. On Linux (Kubuntu 11.10 in my case), it is located at e.g. /etc/postgresql/8.4/main/environment and empty by default, apart from a few helpful comments.

On Mac OSX Lion, the file does not seem to exist: I would expect it at e.g. /Library/PostgreSQL/9.0/data/ as that's where all the other configuration files are, but it is not there - and if I create it, it does not seem to be used.

How can I set environment variables for the PostgreSQL server on Mac OSX ?

3
  • I can't find anything about such a file in the official Postgres docs, so I believe it's a Ubuntu/Debian artifact. Commented Mar 7, 2012 at 7:52
  • What should these envitionment variables contain? If you need to change settings, the config is probably better, if you need to change settings based on database/table/... there are specific settings for it. Commented Mar 7, 2012 at 9:03
  • how do you set PYTHONPATH in the config ? Commented Mar 8, 2012 at 1:40

1 Answer 1

1

There is no standard way to specify environment variables for PostgreSQL, I assume that file is Kubuntu specific.

What I did to ease my life was copying approach used by ORACLE:

  • I have /etc/pgtab file on each server where I run PostgreSQL databases;
  • I specify each cluster I run on a single line in the /etc/pgtab;
  • I've created a script pgenv which based on the /etc/pgtab shows the menu of clusters (in case there're more then just one) and initialize all PATHs and variables.

It works on my MacBookPro and on all Linux and HP-UX based servers.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.