Bug #81225 str_to_date with before insert trigger results in null
Submitted: 28 Apr 2016 16:48 Modified: 26 Jun 2016 19:00
Reporter: Kevin Hetman Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:5.6.30 OS:CentOS (3.10.0-327.13.1.el7.x86_64)
Assigned to: CPU Architecture:Any
Tags: before_insert_trigger, STR_TO_DATE

[28 Apr 2016 16:48] Kevin Hetman
Description:
In using a date in the format of "28 Apr 2016 16:39:46", I have discovered that the check MySQL performs for a trigger on the argument results in a null value.

Example trigger:
CREATE DEFINER=`xxxxx`@`%` 
TRIGGER `<trigger_name>` 
BEFORE 
INSERT ON `<table_name>` FOR EACH ROW 
SET NEW.timestamp = STR_TO_DATE('NEW.timestamp', '%d %b %Y %H:%i:%S'), NEW.Id = UUID();

How to repeat:
Create a table with field defined as datetime.  Create a trigger similar to that in the description.  

Suggested fix:
I have created a workaround for the time being which is the use a tmp field, perform the str_to_date function on the value, then use the new value for NEW.timestamp.
[26 May 2016 19:00] MySQL Verification Team
Thank you for the bug report. Please instead to just describe the test case provide the complete test case scripts the actual result and expected one. Thanks.
[27 Jun 2016 1: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".