Reputation: 101
How can I use pg_dumpall
with Heroku? The default "database backup" feature from Heroku is pg_dump
with the click of a button, which doesn't include roles, so I want to do pg_dumpall
... I'm trying pg_dumpall -h myherokuurl.compute-1.amazonaws.com -l mypassword -U myUser > dump.sql
I'm getting this error:
pg_dumpall: error: query failed: ERROR: permission denied for table pg_authid
pg_dumpall: error: query was: SELECT oid, rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolconnlimit, rolpassword, rolvaliduntil, rolreplication, rolbypassrls, pg_catalog.shobj_description(oid, 'pg_authid') as rolcomment, rolname = current_user AS is_current_user FROM pg_authid WHERE rolname !~ '^pg_' ORDER BY 2
My first thought was to create a new user with the correct privileges. So, I logged using heroku pg:psql DATABASE -a my-app-name
then tried create user myUser with password 'mypassword'
but got the error ERROR: permission denied to create role
I'm honestly not sure what's going on I'm kind of just guessing. Any troubleshooting ideas would be appreciated! (in the meantime I'm just trying to learn more about Postgres)
Upvotes: 3
Views: 1245
Reputation: 1212
If your problem is just about the pg_authid
catalog, you should be able to use recent versions of pg_dumpall
with the --no-role-passwords
option.
This commonly works in hosted environments where pg_authid
is inaccesible, e.g. on AWS. The only downside is that the passwords of Postgres users will be missing from the dump.
However, you appear to have a more limited, perhaps shared environment, where you can't even create new Postgres users. I am not certain if there is any chance to get pg_dumpall
working there.
Upvotes: 7