163
sdilshod@sdilshod-Lenovo-B590:~/webapp/saturn$ heroku run rake db:migrate
Running `rake db:migrate` attached to terminal... up, run.6194
DEPRECATION WARNING: You have Rails 2.3-style plugins in    vendor/plugins! Support for these plugins will be removed in Rails 4.0.  Move them out and bundle them in your Gemfile, or fold them in to your app  as lib/myplugin/* and config/initializers/myplugin.rb. See the release  notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2- 0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
DEPRECATION WARNING: You have Rails 2.3-style plugins in  vendor/plugins! Support for these plugins will be removed in Rails 4.0.   Move them out and bundle them in your Gemfile, or fold them in to your app   as lib/myplugin/* and config/initializers/myplugin.rb. See the release   notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-  0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
 Error: You must install at least one postgresql-client-<version> package.
 rake aborted!
 Error dumping database
 /app/vendor/bundle/ruby/1.9.1/gems/activerecord-   3.2.12/lib/active_record/railties/databases.rake:415:in `block (3 levels)   in <top (required)>'
 /app/vendor/bundle/ruby/1.9.1/gems/activerecord- 3.2.12/lib/active_record/railties/databases.rake:188:in `block (2 levels) in <top (required)>'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/railties/databases.rake:182:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:structure:dump
(See full trace by running task with --trace)

heroku pg:psql works fine, but when i do migrate rake db:migrate it get error that needs to install pg client. Where i need to install pg client? Any help

dilshod
  • 1,831
  • 2
  • 12
  • 11
  • 1
    I found [this][1] solution and fix error [1]: http://stackoverflow.com/questions/17300341/migrate-not-working-on-heroku – dilshod Feb 03 '15 at 13:51

4 Answers4

333

On a Debian based system the PostreSQL client programs are provided by postgresql-client-common as symbolic links to /usr/share/postgresql-common/pg_wrapper.

If you install that package and attempt to use any of the PostgreSQL client programs like psql, pg_dump, pg_dumpall, and pg_restore, the pg_wrapper without having the version specific binary package installed, like postgresql-client-9.1 it will emit this error:

You must install at least one postgresql-client-< version > package

The easiest way to fix this is to install the postgresql-client metapackage. It always depends on the currently supported database client package for PostgreSQL on Debian based systems and it depends on postgresql-client-common

sudo apt-get install postgresql-client
jla
  • 6,904
  • 2
  • 36
  • 34
  • Thanks for response, jla! It seems bug heroku and i found http://stackoverflow.com/questions/17300341/migrate-not-working-on-heroku to solve – dilshod Mar 18 '15 at 02:41
  • You're welcome. I found this when searching for the "at least one" error message from using psql on the command line and not using heroku. After I found the answer I wanted to leave a Debian specific fix that gives a working pg_dump and psql for the Debian specific error as an alternate to the suggested heroku fix of ignoring the error. – jla Mar 19 '15 at 23:35
  • 1
    running `sudo apt-get install postgresql-client` via `heroku run bash` doesn't work? It returns `bash: sudo: command not found`. What am I missing here? – s2t2 Aug 20 '15 at 02:10
  • Running this command `sudo apt install postgresql-client-common` – Julfikar Haidar Jul 28 '22 at 15:27
34

Update March 30th, 2020

Agree with the chosen answer, but I found to install postgresql-client-12 on a Ubuntu 18 slightly more involved.

sudo apt update
sudo apt -y install vim bash-completion wget
sudo apt -y upgrade
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
sudo apt update
sudo apt -y install postgresql-client-12

See this reference for details.

arcseldon
  • 35,523
  • 17
  • 121
  • 125
12

For Ubuntu 18.04.6 LTS it works with only two commands;

sudo apt-get install postgresql-client-common

and

sudo apt-get install postgresql-client
mPrinC
  • 9,147
  • 2
  • 32
  • 31
Bharat Gadade
  • 437
  • 4
  • 6
0

with new version postgresql 14, I follow up this document

http://apt.postgresql.org/pub/repos/apt/README

$ sudo su - 

$ lsb_release -c

Codename:       focal

$ echo "deb http://apt.postgresql.org/pub/repos/apt/ focal-pgdg main" > /etc/apt/sources.list.d/pgdg.list

$ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install postgresql-client-14
Bill
  • 2,494
  • 5
  • 26
  • 61