Question

How can I create a Postgres 16 user that has permission to create tables on an app platform dev database?

I’m trying to figure out how (or if?) I can run Postgres 16 on app platform with a Django application. I’m getting the following error message:

[2024-08-13 11:58:42] psycopg2.errors.InsufficientPrivilege: permission denied for schema public
[2024-08-13 11:58:42] LINE 1: CREATE TABLE "django_migrations" ("id" integer NOT NULL PRIM...

I understand this is because since Postgres 15 the default user doesn’t have permission to create tables, and that the solution should be to login to the database as the admin user and grant those permissions, as described in these posts:

https://www.digitalocean.com/community/questions/permission-denied-for-database-postgres-when-creating-schemas-in-dev-database https://www.digitalocean.com/community/questions/how-to-provide-access-to-a-public-scheme-in-postgresql-15-or-16-using-terraform

However, I can’t seem to find a way to get the admin user information from the dev database in app platform, so I don’t have a way to login and run this. The connection string that is visible from the app settings page is not for the admin user, and when I try to get it from the doctl databases list command or similar the database doesn’t show up anywhere.

Is there a way to do this or is it not possible to use Postgres 15+ on a dev database that needs to create tables anymore?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

I’m having this exact same problem! I have a dev database that is postgresql 16 and I am unable to create tables in the public schema with the provided username, but don’t know the credentials for the doadmin user.

Can someone please help me understand how I am supposed to create the tables and views I require for my app?

Thanks.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.