Coding⏱️ 2 min read📅 2026-05-31

How to Fix: ERROR: permission denied for sequence cities_id_seq using Postgres

SQL permission denied error due to incorrect sequence grant.

Quick Answer: The issue is caused by the incorrect spelling of 'cities_id_seq' in the last grant statement. Change 'ci' to 'cities_id_seq'.

The error 'ERROR: permission denied for sequence cities_id_seq using Postgres' occurs when the PostgreSQL server cannot grant permissions to a user on a specific sequence. This happens because the user is missing the necessary privileges to create or alter sequences in the database.

🔍 Why This Happens

  • [Cause]

🚀 How to Resolve This Issue

Method 1: Re-granting Permissions

  1. Step 1: Drop the existing grants for the user on the sequence using the following SQL command:
REVOKE ALL ON SEQUENCE cities_id_seq FROM www;

Method 2: Re-creating the Sequence

  1. Step 1: Drop the existing sequence using the following SQL command:
DROP SEQUENCE cities_id_seq;

Step 2:

  1. Step 2: Create the sequence again using the following SQL command:
CREATE SEQUENCE cities_id_seq;

💡 Conclusion

[Wrap-up]

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions