PostgresApp icon indicating copy to clipboard operation
PostgresApp copied to clipboard

pg_dump is newer version than my db, causing issues?

Open mepatterson opened this issue 8 years ago • 1 comments

I'm a bit confused. Installed the latest Postgres.app, and love the fact that I can switch between 9.5 and 9.6 but here's the issue I'm having... looks like it installed pg_dump 9.6.2

> pg_dump --version
pg_dump (PostgreSQL) 9.6.2

But I'm running postgres 9.5 for a Rails app I'm working on. Rails uses pg_dump to dump its structure.db file. Each time it does that, since it's using pg_dump 9.6.2, it dumps it like a 9.6 database, which includes idle_in_transaction_session_timeout setting that doesn't work in 9.5 as far as I can tell.

So this is causing issues since rails test suite setup is getting the below error from psql when it tries to do its thing.

I'm confused as to how I should resolve this, since I don't think I have access to a lower version of pg_dump anymore...

psql:/Users/mepatterson/myapp/db/structure.sql:10: ERROR:  unrecognized configuration parameter "idle_in_transaction_session_timeout"

mepatterson avatar Mar 01 '17 23:03 mepatterson

The app includes both versions of pg_dump: 9.5 and 9.6. Which one will be used depends on how you configured your $PATH.

The two versions are at the following paths:

/Applications/Postgres.app/Contents/Versions/9.5/bin/pg_dump
/Applications/Postgres.app/Contents/Versions/9.6/bin/pg_dump

If you followed the instructions on the homepage, your $PATH should be configured to include /Applications/Postgres.app/Contents/Versions/latest, which is a symlink to to /Applications/Postgres.app/Contents/Versions/9.6

Type the command which pg_dump to see which pg_dump is the default, and type echo $PATH to see what your $PATH is set to.

If you followed the instructions on the homepage, /etc/paths.d/postgresapp should contain the path above. Change latest to 9.5 and you're good to go.

Your path could also be configured in any of the shell configuration files, eg. ~/.bash_profile, ~/.profile, and so on.

jakob avatar Mar 02 '17 09:03 jakob