1

I enrolled into a web-host plan so I could have my rails apps published. They provided me with a server and access to it. This is a shared CentOS Linux server and I can access its bash.

I was trying to load my database schema into the postgres database (v8.4) they are offering but it gives me an error when doing so. When I execute:

 RAILS_ENV=production rake db:schema:load

The following error is generated:

-- enable_extension("plpgsql")
rake aborted!
ActiveRecord::StatementInvalid: PG::SyntaxError: ERROR:  syntax error at or near "EXTENSION"
LINE 1: CREATE EXTENSION IF NOT EXISTS "plpgsql"
               ^
: CREATE EXTENSION IF NOT EXISTS "plpgsql"
/home/user/path-to-app/db/schema.rb:17:in `block in <top (required)>'
/home/user/path-to-app/db/schema.rb:14:in `<top (required)>'
PG::SyntaxError: ERROR:  syntax error at or near "EXTENSION"
LINE 1: CREATE EXTENSION IF NOT EXISTS "plpgsql"
               ^
/home/user/path-to-app/db/schema.rb:17:in `block in <top (required)>'
/home/user/path-to-app/db/schema.rb:14:in `<top (required)>'
Tasks: TOP => db:schema:load
(See full trace by running task with --trace)

Because the web-host provider does not allow many db privileges, and due to my unfamiliarity with PostgreSQL, I would prefer a solution changing something on the rails side...

Is there something I can do on the rails side to work around (or hopefully address) this issue?

If nothing can be really done from the rails side I would have to be specific with the privileges necessary.

This PostgreSQL EXTENSION object seems to demand privileges my db user does not have...

What would be the minimum privileges for the rails database user running the db migration in PostgeSQL?

Update

This is about PostgreSQL 8.4, witch according to the comments here do not have the "CREATE EXTENSION" command.

9
  • 1
    CREATE EXTENSION was introduced with Postgres 9.1 Commented Aug 26, 2015 at 9:11
  • that is a relief... should i downgrade the pg gem? Commented Aug 26, 2015 at 9:12
  • it's is not about the pg gem, it's all about Postgres database itself. pg gem it's just the ruby wrapper for Postgres database. Commented Aug 26, 2015 at 9:13
  • possible duplicate of Why can only a superuser CREATE EXTENSION hstore, but not on Heroku? Commented Aug 26, 2015 at 9:13
  • Also related to stackoverflow.com/questions/13410631/… Commented Aug 26, 2015 at 9:13

1 Answer 1

2

CREATE EXTENSION was introduced with Postgres 9.1, i suggest you to run migrations:

RAILS_ENV=production bundle exec rake db:migrate
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.