Why do I get Postgres extension errors when I run `rake db:structure:load` or `rake db:setup`?

Issue

You are seeing ERROR: must be owner of extension plpgsql or similar when you attempt to run rake db:structure:load.

Resolution

When Rails generates structure.sql, it includes commands to enable the database extensions it wants to use. Unfortunately, these are blocked by heroku-postgresql. One way around this is to use config.active_record.schema_format = :ruby, which means your app would generate a schema.rb instead of a structure.sql. schema.rbis compatible with heroku-postgresql because it doesn't enable extensions.

If you need to use structure.sql you can remove COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'; which should also resolve this issue.

Ask on Stack Overflow

Engage with a community of passionate experts to get the answers you need

Ask on Stack Overflow

Heroku Support

Create a support ticket and our support experts will get back to you

Contact Heroku Support
Terms of Service Privacy Cookies © 2018 Salesforce.com