Bug #29533 Trigger sends incorrect values for enumerated columns
Submitted: 3 Jul 2007 21:17 Modified: 3 Aug 2007 21:27
Reporter: Daniel Rhodes Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: Stored Routines Severity:S3 (Non-critical)
Version:5.0.27-standard OS:Linux
Assigned to: CPU Architecture:Any

[3 Jul 2007 21:17] Daniel Rhodes
Description:
Using a trigger with AFTER INSERT and taking values from an enumerated column from a newly inserted row on the first table (with NEW.columnname), the values are incorrect and represent the place in the enumerated values list rather than the actual value itself.

Thus, ENUM(1, -1, 2) with a value of -1 would result in NEW.columnname being 2.

How to repeat:
Set up two tables with one table having a column that is enumerated. I had ENUM(1, -1). 

Make a trigger which inserts into a second table the value that you inserted into the first table's enumerated column.

Insert a row on the first table, and look at the value that results in the second table. It should be the place that this value was in enumerated list, and not the value itself.

Suggested fix:
NEW.columnname should return the value itself, not the place in the enumerated list.
[3 Jul 2007 21:27] Sveta Smirnova
Thank you for the report.

But version 5.0.27 is quite old. Please try with current version 5.0.41 and if you can repeat described behaviour provide definition of the trigger.
[3 Aug 2007 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".