# Problems using postgresql (postgres-pr) gem

**URL:** <https://discuss.rubyonrails.org/t/problems-using-postgresql-postgres-pr-gem/56791>\
**Category:** rubyonrails-talk\
**Created:** [January 15, 2011, 6:14pm UTC](https://discuss.rubyonrails.org/t/problems-using-postgresql-postgres-pr-gem/56791 "2011-01-15T18:14:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matthew\_Rupert](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@Matthew\_Rupert](https://discuss.rubyonrails.org/u/Matthew_Rupert)\
**Post date:** [January 15, 2011, 6:14pm UTC](https://discuss.rubyonrails.org/t/problems-using-postgresql-postgres-pr-gem/56791/1 "2011-01-15T18:14:54Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![11155](https://avatars.discourse-cdn.com/v4/letter/1/d26b3c/32.png) [@11155](https://discuss.rubyonrails.org/u/11155)\
**Post date:** [January 15, 2011, 8:00pm UTC](https://discuss.rubyonrails.org/t/problems-using-postgresql-postgres-pr-gem/56791/2 "2011-01-15T20:00:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Matthew\_Rupert](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@Matthew\_Rupert](https://discuss.rubyonrails.org/u/Matthew_Rupert)\
**Post date:** [January 15, 2011, 9:09pm UTC](https://discuss.rubyonrails.org/t/problems-using-postgresql-postgres-pr-gem/56791/3 "2011-01-15T21:09:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![11155](https://avatars.discourse-cdn.com/v4/letter/1/d26b3c/32.png) [@11155](https://discuss.rubyonrails.org/u/11155)\
**Post date:** [January 15, 2011, 9:17pm UTC](https://discuss.rubyonrails.org/t/problems-using-postgresql-postgres-pr-gem/56791/4 "2011-01-15T21:17:44Z")

</div>

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:

activerecord-2.3.5/lib/active\_record/connection\_adapters/postgresql\_adapter.rb

(replace 2.3.5 with your flavor of Rails)

begin &nbsp;&nbsp;require\_library\_or\_gem 'pg' rescue LoadError =\> e &nbsp;&nbsp;begin &nbsp;&nbsp;&nbsp;&nbsp;require\_library\_or\_gem 'postgres' &nbsp;&nbsp;&nbsp;&nbsp;class PGresult &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alias\_method :nfields, :num\_fields unless self.method\_defined?(:nfields) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alias\_method :ntuples, :num\_tuples unless self.method\_defined?(:ntuples) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alias\_method :ftype, :type unless self.method\_defined?(:ftype) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alias\_method :cmd\_tuples, :cmdtuples unless self.method\_defined?(:cmd\_tuples) &nbsp;&nbsp;&nbsp;&nbsp;end &nbsp;&nbsp;rescue LoadError &nbsp;&nbsp;&nbsp;&nbsp;raise e &nbsp;&nbsp;end end

---

<div class="post-metadata">

**Author:** ![Matthew\_Rupert](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@Matthew\_Rupert](https://discuss.rubyonrails.org/u/Matthew_Rupert)\
**Post date:** [January 15, 2011, 11:40pm UTC](https://discuss.rubyonrails.org/t/problems-using-postgresql-postgres-pr-gem/56791/5 "2011-01-15T23:40:06Z")

</div>

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