django.db.utils.ProgrammingError: permission denied: "RI_ConstraintTrigger_a_25437" is a system trigger

I am trying to disable the triggers for one of my PostgreSQL table using the following code

def disable_triggers(self):
    with connection.cursor() as cursor:
        cursor.execute('ALTER TABLE "frontend_awsregions" DISABLE TRIGGER ALL;')

But this is giving me following error

... ...
return self.cursor.execute(sql) django.db.utils.ProgrammingError: permission denied: "RI_ConstraintTrigger_a_25437" is a system trigger

when I execute the same query in PGAdmin, its working properly

1 answer

  • answered 2018-10-11 20:30 Shobi

    I went and turned on the superuser permission from PgAdmin for the current DB user. and it fixed it for me.

    Enable superuser permissions from PgAdmin