The context is pertinent as it demonstrates behaviour different than other (more manual) successful attempts.

Deploying a rails application with postgres and postgis extension to AWS EC2 instance, using the rubber gem, database migration initiates but halts with undefined method 'point' for #<ActiveRecord::ConnectionAdapters::PostgreSQLAdapter: is being generated when reaching

      t.point :lonlat, :srid => 3785

This is indicative of the extension not being accessed.

The database is created with user postgres (and I surmise this may be an initial problem, leading to permissions issues). When logging in as postgres and access psql for the database,CREATE SCHEMA postgis; and CREATE EXTENSION PostGIS WITH SCHEMA postgis; return errors because they already exist. So the extension is installed.

Yet SELECT PostGIS_full_version(); fails. I have found by trial and error that SET search_path = public, postgis; will activate PostGIS_full_version. However, even when activated, if a database migration is launched immediately after as ubuntu user, it fails just as well; thus the extension is not accessible (or the search_path is not granted to all).

I have also found that after a sudo service postgresql restart the SELECT PostGIS_full_version(); fails anew for the postgres user.

Behaviour is consistent between 9.3 and 9.4

How can the search_path be persistent and available across users?

[note: question posted to this site as the hunch is that it is a postgresql user permission and object access issue]

  • Have you tried to set the search_path permanently? SET does it for the current session, you have to do an ALTER DATABASE bla SET search_path blu instead.
    – dezso
    Sep 23, 2015 at 8:40
  • Have tried it just now. One thing has changed: postgres user can ask psql SELECT PostGIS_full_version(); and get a proper response, even after restart. So persistence is resolved. However the migration fails at the same spot. Permissions issue?
    – Jerome
    Sep 23, 2015 at 10:33
  • Do you log the respective error on the PostgreSQL side? Or does it appear only on the Rails side?
    – dezso
    Sep 23, 2015 at 11:40
  • I admit I did not go through the postgre logs. the error appears on the rails side on a rake db:migrate command
    – Jerome
    Sep 23, 2015 at 11:44
  • Confirmed. Rebuilt an instance. var/log/postgresql/postgresql-9.4-main.log does not manifest any error from the rails process.
    – Jerome
    Sep 23, 2015 at 13:50


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.