ERROR: permission denied to create extension "x" — Must be superuser to create this extension.
Your role lacks the privilege to create that extension.
Seen on:
PostgreSQL
Meaning
Untrusted extensions need superuser. PostgreSQL 13+ allows database owners to create trusted extensions; managed services provide special roles (rds_superuser, azure_pg_admin).
Common causes
- Non-superuser creating an untrusted extension
- Not the database owner
- Managed DB without the admin role
⚡ Quick fix
- Create it as a superuser/admin role once
- Use trusted extensions
- On RDS/Azure use the provided admin role
Detailed fix by platform
PostgreSQL
sudo -u postgres psql -d appdb -c 'CREATE EXTENSION IF NOT EXISTS pgcrypto;'
How to diagnose
- Role — Superuser or owner?
- Recent change — Did it start after a deploy, upgrade, or configuration change? Compare with the last working version.
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026