pg_dump not working - do I need to change order of $PATH?

Posted by A4J on Server Fault See other posts from Server Fault or by A4J
Published on 2012-09-11T19:52:59Z Indexed on 2012/09/11 21:40 UTC
Read the original article Hit count: 305

I'm trying to set the $PATH to pick up the latest version of pg_dump as I'm currently getting a mismatch error while doing a migrate in my Rails app (I recently changed the schema type to SQL).

I have added a new file in /etc/profile.d called pg_dump.sh, and inside that put:

PG_DUMP=/usr/pgsql-9.1
export PG_DUMP
PATH=$PATH:$PG_DUMP/bin
export PATH

On looking at echo $PATH, I get:

/usr/local/rvm/gems/ruby-1.9.3-p194/bin:/usr/local/rvm/gems/ruby-1.9.3-p194@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p194/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/pgsql-9.1/bin:/root/bin

And I still get the error.

Do I need to change the order? If so any ideas how?


Output of 'ls /usr/pgsql-9.1/bin':

clusterdb droplang pg_archivecleanup pg_ctl pg_standby psql createdb dropuser pg_basebackup pg_dump pg_test_fsync reindexdb createlang ecpg pgbench pg_dumpall pg_upgrade vacuumdb createuser initdb pg_config pg_resetxlog postgres vacuumlo dropdb oid2name pg_controldata pg_restore postmaster

And output of 'which pg_dump':

/usr/bin/pg_dump


Error message on running cap 'deploy:migrate':

 ** [out :: 46.4.9.199] pg_dump: server version: 9.1.4; pg_dump version: 8.4.11
 ** [out :: 46.4.9.199] pg_dump: aborting because of server version mismatch
 ** [out :: 46.4.9.199] rake aborted!
 ** [out :: 46.4.9.199] Error dumping database

output of 'pg_dump --version':

pg_dump (PostgreSQL) 8.4.11

© Server Fault or respective owner

Related posts about linux

Related posts about postgresql