Topic: Rails server error after rails and postgresql upgrade

I upgraded rails from 3.0 to 3.1, and upgraded postgresql from 8.1 to 9.2

Now when I run 'rails server' I get the error:
No such file or directory /usr/local/lib/ruby/gems/1.8/gems/pg-0.11.0/lib/pg_ext.so

pg_ext.so actually exists in the specified directory, so there must be some kind of version conflict.

Is there something I should do to tell rails that I upgraded my version of postgresql?

Thanks in advance for any help.  --Fred

P.S. the only reason I upgraded postgresql after upgrading rails to 3.1 is because when I tried to open my app, rails told me my version of postgresql was too old and to upgrade.

Re: Rails server error after rails and postgresql upgrade

Did you update Gemfile to reflect the new Postgresql gem?

I'm not sure of the exact version,  but try

gem 'pg', '~> '0.13.1'

and run bundle install

http://rubygems.org/gems/pg

says "0.13.1"  works on PostgreSQL 8.3 and later

Joe got a job, on the day shift, at the Utility Muffin Research Kitchen, arrogantly twisting the sterile canvas snout of a fully charged icing anointment utensil.

Re: Rails server error after rails and postgresql upgrade

Thanks for your reply.
Is there documentation that describes what one is supposed to do to rails when a database driver is upgraded?
I ask because postgresql 9.1 is a new installation and I would think that rails needs this information, but i don't know how to supply it.

I added gem 'pg', '~>0.13.1' to my gem file and ran bundle install as you suggest.

Result:
"checking for pg_conf ... no"
Part of the problem may be that I renamed the original postgresql install directory, and the new version is in a different directory still.

So how do I tell rails where the new postgresql install is?

Thanks,  --Fred

P.S. when I run bundel I get whole list of deprication warnings, what is one supposed to do about them?

Last edited by fredrated (2012-02-13 16:04:11)

Re: Rails server error after rails and postgresql upgrade

export PATH=/opt/local/lib/postgresql83/bin:$PATH

obviously change the path to where you have postgresql installed

then try bundle install again.

Deprecation warnings:

You can ignore them until you upgrade to a new version of rails, and something stops working then you'll HAVE to deal with them,  eliminate the deprecated features, code or whatever and do it the new way.

Joe got a job, on the day shift, at the Utility Muffin Research Kitchen, arrogantly twisting the sterile canvas snout of a fully charged icing anointment utensil.

Re: Rails server error after rails and postgresql upgrade

Also, I think you have to install postgresql development package,  the pg_conf file gets installed by the development package.

Last edited by BradHodges (2012-02-13 16:36:27)

Joe got a job, on the day shift, at the Utility Muffin Research Kitchen, arrogantly twisting the sterile canvas snout of a fully charged icing anointment utensil.

Re: Rails server error after rails and postgresql upgrade

Better, but still no banana.
adding the path export allows bundle install to run to completion without error, but the original 'rails server' still will not execute properly.
The same error, but slightly changed with the postgres upgrade:
No such file or directory /usr/local/lib/ruby/gems/1.8/gems/pg-0.13.1/lib/pg_ext.so
The file actually exists in the referenced path.

Is it possible I went too far by upgrading postgresql to 9 instead of the latest version of 8?
Otherwise I am still flumoxed.

Re: Rails server error after rails and postgresql upgrade

You probably need to add a new path to LD_LIBRARY_PATH.

What Unix are you using?

Temporarily try

export LD_LIBRARY_PATH=/usr/local/lib/ruby/gems/1.8/gems/pg-0.13.1/lib:$LD_LIBRARY_PATH

If that fixes it,  you have to permanently put that path in,  there are several ways to go,  but just make sure when you do to deploy,  the apache account or whatever you use has that path set up.

Joe got a job, on the day shift, at the Utility Muffin Research Kitchen, arrogantly twisting the sterile canvas snout of a fully charged icing anointment utensil.

Re: Rails server error after rails and postgresql upgrade

Thanks for your reply, but now it gets stranger.
I get, when I try to start rails server:
libpq.so.5: cannot open shared object file: No such file or directory - /usr/local/lib/ruby/gems/1.8/gems/pg-0.13.1/lib/pg_ext.so (LoadError)
  from usr/local/lib/ruby/gems/1.8/gems/-pg-0.13.1/lib/pg.rb:4
  from blah blah blah.....

It is pretty clear from the line "from /usr/local/lib ..... pg.rb:4" that the directory exists or it couldn't have called pg.rb from the same directory.  In addition, I am looking at the directory now and I can see pg_ext.so in the directory!!!!!!!!!

As for linux, I am using SUSE Linux Enterprise Server VERSION=10 PATCHLEVEL=4

Thanks for your replys, it has been really game of you, but at this point do I have any recourse besides clearing everything from the server and starting over with Rails 3.1 and postgresql 9.1 as the initial installs?  Thanks again for your help.  -Fred

Re: Rails server error after rails and postgresql upgrade

When you have a dynamically loaded library loading another dynamically loaded library,  you have to more permanently set up the load paths.

In Linux I think you need to use the ldconfig and edit /etc/ld.so.conf

Sorry,  I only know Solaris well,  but I used it back in the days when it was Berkeley based,  and I assume Linux today is similar old SunOS, (we're going back to 1991, yikes!)

Joe got a job, on the day shift, at the Utility Muffin Research Kitchen, arrogantly twisting the sterile canvas snout of a fully charged icing anointment utensil.