‘Subquery returned more than 1 value’ error on UPDATE when Trigger attached

If you try to do a mass update to a table that has an update trigger attached to it, you will get the following error:

Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

All you need to do to fix this is to disable your trigger, run the query, enable the trigger. This can be done like this:

ALTER TABLE my_table DISABLE TRIGGER my_table_trigger
update my_table set col_name = new_value
ALTER TABLE my_table ENABLE TRIGGER my_table_trigger

Leave a Reply

Your email address will not be published. Required fields are marked *