问题
I'm trying to add a database extension to one of my applications, specifically the fuzzystrmatch extension. Whenever I try to add it I get the following error
-- execute("CREATE EXTENSION fuzzystrmatch") rake aborted! An error has occurred, this and all later migrations canceled:
PGError: ERROR: permission denied to create extension "fuzzystrmatch" HINT: Must be superuser to create this extension. : CREATE EXTENSION fuzzystrmatch
The only thing I've found about becoming a superuser is this:
https://blog.engineyard.com/2012/postgresql-9-1-is-now-in-beta`
What I don't know is how to do it? Do I ssh into the database then have to sudo execute the command? Everything I've found has been very unhelpful. Any help is appreciated thanks.
回答1:
Disclaimer: I'm one of Engine Yard's DBAs.
On Engine Yard your application's DB user account is not a superuser. You do have access to the superuser account, however - just use the "postgres" user instead. Obviously you would only want to use this for administrative tasks, and not from within your application!
That said, Engine Yard already provides a means to enable this and other extensions for Postgres, as mentioned at the end of the blog post you linked. You can customise your environment using chef recipes, and we provide recipes to enable postgres extensions in our custom chef repo located at: https://github.com/engineyard/ey-cloud-recipes/tree/master/cookbooks/postgresql9_extensions
If you're already using custom chef recipes in your environment then getting that set up should be straight forward - if not, I recommend you start with the documentation here: https://support.cloud.engineyard.com/entries/21009867-Customize-Your-Environment-with-Chef-Recipes
If you run into trouble with any of this, then please open a ticket and we'll be glad to assist!
来源:https://stackoverflow.com/questions/15398714/becoming-database-superuser-engineyard