Page MenuHomePhabricator

Disabling triggers in PostgreSQL can only be done by super user
Closed, ResolvedPublic

Description

Author: wikipedia

Description:
When restoring a dump of wikipedia into PostgreSQL with mwdump, the first lines are :

ALTER TABLE revision DISABLE TRIGGER ALL;ALTER TABLE page DISABLE TRIGGER ALL;;

this will result in :

ERROR: permission denied: "RI_ConstraintTrigger_XXXXX" is a system trigger
ERROR: permission denied: "RI_ConstraintTrigger_XXXXX" is a system trigger

because some triggers are managed by the database server itself and cannot be disabled by any one, except the super user. However there is a way [1] to delay the constraints applications in order to load a whole bunch of data in the database and do not need to be super-user :

At the beggining : SET CONSTRAINTS ALL DEFERRED
At the end : SET CONSTRAINTS ALL IMMEDIATE

[1] http://kopongo.com/2008/7/25/postgres-ri_constrainttrigger-error


Version: unspecified
Severity: normal

Details

Reference
bz21548

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:46 PM
bzimport set Reference to bz21548.

wikipedia wrote:

For this previous comment to work, all constraints must be deferrable which is not the case right now in the SQL schema -> I proposed a patch in Bug 21549

wikipedia wrote:

*** This bug has been marked as a duplicate of bug 19883 ***