[MDEV-4829] BEFORE INSERT triggers dont issue 1406 error Created: 2013-07-31 Updated: 2015-11-18 Resolved: 2015-11-17 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Triggers |
| Affects Version/s: | 5.5.32, 5.5, 10.0, 10.1 |
| Fix Version/s: | 10.1.9 |
| Type: | Bug | Priority: | Major |
| Reporter: | Federico Razzoli | Assignee: | Alexey Botchkov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | upstream-fixed, verified | ||
| Issue Links: |
|
||||||||
| Sprint: | 10.1.7-1, 10.1.7-2, 10.1.8-1, 10.1.8-3, 10.1.8-4, 10.1.9-2, 10.1.9-3 | ||||||||
| Description |
|
I created a BEFORE INSERT trigger which modifies a value making it too long. Despite the sql_mode, no error/warning appears.
Sorry, i dont have a MySQL installed locally anymore, so i dont know if this bug is mainstream. Some notes...
|
| Comments |
| Comment by Elena Stepanova [ 2013-07-31 ] | |||||||||||||||||||||||||||||||||||||||||||
|
Hi Federico, Yes, it seems to be another known legacy bug: http://bugs.mysql.com/bug.php?id=42910 | |||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2014-11-10 ] | |||||||||||||||||||||||||||||||||||||||||||
|
Fixed in MySQL 5.7.5:
| |||||||||||||||||||||||||||||||||||||||||||
| Comment by Federico Razzoli [ 2015-05-01 ] | |||||||||||||||||||||||||||||||||||||||||||
|
Hi. Now that it is "upstream-fixed", are there more chances to see this fixed in MariaDB? | |||||||||||||||||||||||||||||||||||||||||||
| Comment by Alexey Botchkov [ 2015-09-24 ] | |||||||||||||||||||||||||||||||||||||||||||
|
Fix proposal: http://myoffice.izhnet.ru/~af/mdev4829-patch | |||||||||||||||||||||||||||||||||||||||||||
| Comment by Aurélien LEQUOY [ 2015-10-14 ] | |||||||||||||||||||||||||||||||||||||||||||
|
even if you replace : SET NEW.c = 'www'; by SET NEW.c = 'w'; it's will show 'w' instead of 'a', so it's don't work at all | |||||||||||||||||||||||||||||||||||||||||||
| Comment by Federico Razzoli [ 2015-10-14 ] | |||||||||||||||||||||||||||||||||||||||||||
|
Aurélien, I don't know if I understand your comment. But if I set NEW.c = 'w', I expect the new row to contain 'w'... what's the problem? | |||||||||||||||||||||||||||||||||||||||||||
| Comment by Aurélien LEQUOY [ 2015-10-28 ] | |||||||||||||||||||||||||||||||||||||||||||
|
BEFORE INSERT INSERT INTO t1 VALUES ('a'); so for me I understand like that : INSERT INTO t1 VALUES ('w'); if it was after insert this case is good, but in example it's before. it's was I found strange to see a 'w' there. in this example I understood that like it was a default value, if this field is not set in insert | |||||||||||||||||||||||||||||||||||||||||||
| Comment by Alexey Botchkov [ 2015-11-16 ] | |||||||||||||||||||||||||||||||||||||||||||
|
Proposed fix, sort of small one: | |||||||||||||||||||||||||||||||||||||||||||
| Comment by Alexey Botchkov [ 2015-11-16 ] | |||||||||||||||||||||||||||||||||||||||||||
|
Here's the alternative fix where i'd modify the existing STRICT mode implementation using error handler. | |||||||||||||||||||||||||||||||||||||||||||
| Comment by Alexey Botchkov [ 2015-11-16 ] | |||||||||||||||||||||||||||||||||||||||||||
|
So there's two different patches. Second one is quite massive, but i think it makes code look more understandable. | |||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2015-11-17 ] | |||||||||||||||||||||||||||||||||||||||||||
|
holyfoot, would this fix the following transformation of a BEFORE insert correcting a column value too?
| |||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2015-11-17 ] | |||||||||||||||||||||||||||||||||||||||||||
| Comment by Aurélien LEQUOY [ 2015-11-18 ] | |||||||||||||||||||||||||||||||||||||||||||
|
will be fixed in 10.1.9 ? | |||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2015-11-18 ] | |||||||||||||||||||||||||||||||||||||||||||
|
Sorry (the FixVersion was incorrect). It is fixed in 10.1.9, but not in 10.0 |