0

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
  • Try psql -U postgres -c 'select version()'. This will probably show that you're running a 9.3 server. The 9.4.1 reported by psql --version is the client-side. Presumably postgresql94 for MacPorts does not contain the server, it's another package. – Daniel Vérité Mar 17 '15 at 18:14
  • Yes you are right, it reported PostgreSQL 9.3.4. But after port install postgresql94-server select version() still reports 9.3.4. How to proceed? – Imran Mar 17 '15 at 18:37
  • A quick websearch does not find it for me, but hopefully MacPorts or someone has documented how to upgrade to a newer major server version. A dump/reload is certainly needed (the data directories are not compatible across major versions) – Daniel Vérité Mar 17 '15 at 19:17

Your Answer

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

Browse other questions tagged or ask your own question.