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

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.