Pg_dump version mismatch in Rails

While running the rake db:structure:dump command, I found the following error:

 Larson-2:app larson$ rake db:structure:dump pg_dump: server version: 9.1.3; pg_dump version: 9.0.4 pg_dump: aborting because of server version mismatch rake aborted! Error dumping database 

How can I update pg_dump? I have pg 9.1.3 installed, is there a way to update links inside Rails to a new version?

When I try to update postgres via homebrew, I get the following output:

 Larson-2:app larson$ sudo brew upgrade postgresql Password: Error: postgresql already upgraded 
+4
source share
3 answers

Here is how I solved the problem, first updated my homebrew:

brew update
if you get this error: error: Your local changes to the following files would be overwritten by merge:

then

 cd /usr/local/cellar git reset --hard FETCH_HEAD 

After completing the homebrew update:
sudo brew install postgresql
Which will install 9.1.3 (or the latest version of pg) and any dependencies.

+5
source

on my machine the problem was in PATH. was pg_dump v. 9.0.10 in / usr / bin, and my server was 9.1.something.

Changing the path to make / usr / local / Cellar / postgres / 9 .... / bin (or something that is the path to the postgres installation you use) is used before anything else works like the wind. I only needed to open an open terminal window.

+1
source

I had the same problem. They followed the documentation on the postgress command line tools, then I had to run rake:db reset , then rake db:test:prepare to copy my test database. After I did this, it worked.

0
source

Source: https://habr.com/ru/post/1402595/


All Articles