I have installed the PostgreSQL 9.4 on my MacBook via MacPorts, and I am trying to edit pg_hba.conf, but I don't see it in my current installation. Furthermore, psql is reporting that config_file is in my old 9.3 directory! How should I fix this?
$ port select --list postgresql
Available versions for postgresql:
none
postgresql93
postgresql94 (active)
$ psql --version
psql (PostgreSQL) 9.4.1
$ psql -U postgres -c 'SHOW config_file'
config_file
----------------------------------------------
/Library/PostgreSQL/9.3/data/postgresql.conf
(1 row)
$ ls /Library/PostgreSQL/9.3/data
PG_VERSION pg_hba.conf pg_notify pg_stat_tmp pg_xlog
base pg_ident.conf pg_serial pg_subtrans postgresql.conf
global pg_log pg_snapshots pg_tblspc postmaster.opts
pg_clog pg_multixact pg_stat pg_twophase postmaster.pid
$ ls /Library/PostgreSQL/9.4/data
ls: /Library/PostgreSQL/9.4/data: No such file or directory
$ ls /Library/PostgreSQL/9.4
ls: /Library/PostgreSQL/9.4: No such file or directory
$ psql -U postgres -c 'SHOW data_directory'
data_directory
------------------------------
/Library/PostgreSQL/9.3/data
(1 row)
$ locate pg_hba.conf
/Library/PostgreSQL/9.3/share/postgresql/pg_hba.conf.sample
/opt/local/share/postgresql93/pg_hba.conf.sample
/opt/local/share/postgresql94/pg_hba.conf.sample
$ ls /opt/local/share/postgresql94
conversion_create.sql postgres.bki snowball_create.sql
extension postgres.description sql_features.txt
information_schema.sql postgres.shdescription system_views.sql
pg_hba.conf.sample postgresql.conf.sample timezone
pg_ident.conf.sample psqlrc.sample timezonesets
pg_service.conf.sample recovery.conf.sample tsearch_data
Best Answer
Until postgres version 9.5 the upgrade procedure was to
the selection of the cluster depends on the PGDATA environment variable. the version of the cluster software version depends on the PATH environment variable. Make sure they match your needs. The setting is done in the startup scripts and can be copied for the client.