Problems using postgresql (postgres-pr) gem

I’ve trying to use the postgres-pr gem on CentOS/Ruby 1.9.2. When I
attempt to run Webrick (or rake update), I get an error saying that it
cannot find the gem “postgres.” I’m not sure why, because nowhere in
my Gemfile or database.yml do I refer to anything called “posgres.”

Any suggestions?

Postgres is confusing (to me). I install “pg (0.10.0)” and that is
working for me. I’m currently toying with Rails 3 using Ruby 1.9.2 but
I’ve done lots of Ruby 2 using Ruby 1.8 and 1.9.1.

If you use the --database=postgresql option when you create your
project, it will have this at the top:

PostgreSQL. Versions 7.4 and 8.x are supported.

Install the pg driver:

gem install pg

On Mac OS X with macports:

gem install pg –


On Windows:

gem install pg

Choose the win32 build.

Install PostgreSQL and put its /bin directory on your path.

Good luck

I got the same error using the pr gem… Strange. There is some
dependency somewhere that I can’t find.

Is it possible that when you do “gem” you are using a different copy of
Ruby than if you run your rails application?

There is at least one requirement here:


(replace 2.3.5 with your flavor of Rails)

require_library_or_gem ‘pg’
rescue LoadError => e
require_library_or_gem ‘postgres’
class PGresult
alias_method :nfields, :num_fields unless
alias_method :ntuples, :num_tuples unless
alias_method :ftype, :type unless self.method_defined?(:ftype)
alias_method :cmd_tuples, :cmdtuples unless
rescue LoadError
raise e

Possible… Thanks for the suggestions. I’ll have to try that out.