0

I use Postgresql 9.5 in a Vagrant environment: Ubuntu 16.04 Server with the latest updates. I use a Yii2 application. Of course I know there is open issue about this problem, so maybe this is Yii2 related.

I got the following error:

[yii\db\Exception] SQLSTATE[42501]: Insufficient privilege: 7 ERROR:  permission denied: "RI_ConstraintTrigger_c_16773" is a system trigger
The SQL being executed was: ALTER TABLE "public"."address" DISABLE TRIGGER ALL; ALTER TABLE "public"."category" DISABLE TRIGGER ALL; ALTER TABLE "public"."customer" DISABLE TRIGGER ALL;

This error happens when I want to run Codeception tests. But I did not see any config problems. (Because when I use the app as normal user, the database operations works fine.)

I have tried this solution. But it does not work, or this one: but the same, no any effect.

ScaisEdge
  • 131,976
  • 10
  • 91
  • 107
Dabagab
  • 2,497
  • 4
  • 26
  • 31

1 Answers1

0

Only roles with superuser permission can change the foreign key triggers in PostgreSQL as it can tamper data integrity. Using a database user with superuser permission should solve your problem.

Reference: https://www.endpointdev.com/blog/2012/10/postgres-system-triggers-error/

Jon Jensen
  • 61
  • 1
  • 4
uglypointer
  • 377
  • 1
  • 14
  • I have tried this, but the same... no result. The most funny this is a living project, and I did not got any problem during the summers, but now... it just throws these errors. The owner the database (user) and superuser does not matter, still got this problem. – Dabagab Dec 26 '17 at 10:21
  • Tried using postgres user? – uglypointer Dec 26 '17 at 10:25
  • yes. It seems something wrong with the foreign keys, or I do not get why it is so special in Postgresql – Dabagab Dec 26 '17 at 12:22
  • @uglypointer FYI the blog post you reference has moved here: https://www.endpointdev.com/blog/2012/10/postgres-system-triggers-error/ – Jon Jensen Dec 05 '21 at 01:42