0

Possible Duplicate:
Django: permission denied when trying to access database after restore (migration)

Having a similar problem to: After a PostgreSQL restore, I get "permission denied for relation django_session" except that the accepted solution is ineffectual, as per heroku docs I created a backup, and curl'd it to my machine, then ran:

pg_restore -v -c -Ox -d mydb mydump.dump

Initially I got:

django.db.utils.DatabaseError: no schema has been selected to create in

Then after applying the following in psql...

GRANT USAGE ON SCHEMA public TO PUBLIC;
GRANT CREATE ON SCHEMA public TO PUBLIC;

...I got the same as the SO question above...

$ python manage.py syncdb
>>> django.db.utils.DatabaseError: permission denied for relation django_content_type

This really threw me, as I have tried --no-acl && --no-owner (-Ox) have made sure to:

GRANT ALL PRIVILEGES ON DATABASE mydb to myuser

Using django 1.4, & installed apps include django-CMS... Also, the local copy has been working fine with same user w/ different postgresql DB.

Oops:

Apologies for making the classic mistake & assuming my question was SO unique; solution was elsewhere Django: permission denied when trying to access database after restore (migration)

GRANT ALL ON ALL TABLES IN SCHEMA public to user;
GRANT ALL ON ALL SEQUENCES IN SCHEMA public to user;
GRANT ALL ON ALL FUNCTIONS IN SCHEMA public to user;

Did the trick; thanks to unwitting savior: @user698585 ;P

Community
  • 1
  • 1
adm
  • 285
  • 1
  • 3
  • 9
  • Did you try heroku logs --ps postgres and see if it says anything specific? Can you do heroku pg:sql from inside your app and check access privileges? – Pratik Mandrekar Oct 10 '12 at 17:46
  • IMHO it would be worth keeping/ merging this Q- with those cited; as neither is complete without the other. – adm Oct 22 '12 at 10:21

0 Answers0