Bug #66882 error from trigger is hidden - from where error comes ?
Submitted: 19 Sep 2012 21:42 Modified: 7 Nov 2012 15:15
Reporter: Miran Cvenkel Email Updates:
Status: Open Impact on me:
Category:MySQL Server Severity:S4 (Feature request)
Version: OS:Any
Assigned to: CPU Architecture:Any

[19 Sep 2012 21:42] Miran Cvenkel
say I have a trigger on before update on tabe A like this:

set new.id =
  select id
  from table B where ...

This can cause 1242 - subquery returns more than one row

Now, in a while,  I do some 'complicated' update on table A like ....

update A m 
join C d on m.foo= d.foo
set d.foo1 = something',

Trigger is triggered

And the message

Subquery returns more than one row pops up.

That is all, since I forgot about my trigger and concentrating on 'complicated'
query, I'm loosing time not knowing where the problem is (looking for prob in tables involved in update statement, doh it is not there at all !)

If possible, message with note that 1242, or any other error, is coming from trigger would be great.

Then there is a chance that both, update and trigger could cause 1242, or any other error. 

It would be great knowing which instantly.

How to repeat:
see above
[7 Nov 2012 15:15] Miran Cvenkel
So, one shorter description:

update t
set f = ''
where f is null

--> Subquery returns more than 1 row

Makes no sence, right.
Actualy error comes from trigger. And caused only by one record of many.

It would be nice if message would be something like:

--> Subquery returns more than 1 row (Trigger: TriggerName)