Bug #28450 | Certain datetime expression in select list causes assertion failure | ||
---|---|---|---|
Submitted: | 15 May 2007 18:00 | Modified: | 7 Jun 2007 17:06 |
Reporter: | Sergey Petrunya | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 5.1-bk, 5.0-bk | OS: | Any |
Assigned to: | Evgeny Potemkin | CPU Architecture: | Any |
[15 May 2007 18:00]
Sergey Petrunya
[15 May 2007 20:14]
Sveta Smirnova
Thank you for the report. Verified as described.
[29 May 2007 18:42]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/27613 ChangeSet@1.2504, 2007-05-29 22:39:25+04:00, evgen@moonbone.local +4 -0 Bug#28450: The Item_date_add_interval in select list may fail the field type assertion. The bug caused by the fix for bug#16377. The "+ INTERVAL" (Item_date_add_interval) function detects its result type by the type of its first argument. But in some cases it returns STRING as the result type. This happen when, for example, the first argument is a DATE represented as string. All this makes the get_datetime_value() function to misinterpret such result and return wrong DATE/DATETIME value. To avoid such cases in the fix #16377 the code that detects correct result field type on the first execution was added to the Item_date_add_interval::get_date() function. But because of this the result field type of the Item_date_add_interval item stored by the send_fields() function is differ from its result field type when the item is actually being sent and thus failing th field type assertion. Now the get_datetime_value() detects that the DATE value was returned by some item not only by checking the result field type but also by comparing the returned value with the 100000000L constant - any DATE value should be less than it. Removed result field type adjusting code from the Item_date_add_interval::get_date() function.
[29 May 2007 20:05]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/27618 ChangeSet@1.2504, 2007-05-30 00:02:32+04:00, evgen@moonbone.local +4 -0 Bug#28450: The Item_date_add_interval in select list may fail the field type assertion. The bug caused by the fix for bug#16377. The "+ INTERVAL" (Item_date_add_interval) function detects its result type by the type of its first argument. But in some cases it returns STRING as the result type. This happens when, for example, the first argument is a DATE represented as string. All this makes the get_datetime_value() function to misinterpret such result and return wrong DATE/DATETIME value. To avoid such cases in the fix for #16377 the code that detects correct result field type on the first execution was added to the Item_date_add_interval::get_date() function. Due to this the result field type of the Item_date_add_interval item stored by the send_fields() function differs from item's result field type at the moment when the item is actually sent. It causes an assertion failure. Now the get_datetime_value() detects that the DATE value is returned by some item not only by checking the result field type but also by comparing the returned value with the 100000000L constant - any DATE value should be less than this value. Removed result field type adjusting code from the Item_date_add_interval::get_date() function.
[29 May 2007 20:20]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/27619 ChangeSet@1.2504, 2007-05-30 00:17:26+04:00, evgen@moonbone.local +4 -0 Bug#28450: The Item_date_add_interval in select list may fail the field type assertion. The bug was introduced by the patch for bug #16377. The "+ INTERVAL" (Item_date_add_interval) function detects its result type by the type of its first argument. But in some cases it returns STRING as the result type. This happens when, for example, the first argument is a DATE represented as string. All this makes the get_datetime_value() function to misinterpret such result and return wrong DATE/DATETIME value. To avoid such cases in the fix for #16377 the code that detects correct result field type on the first execution was added to the Item_date_add_interval::get_date() function. Due to this the result field type of the Item_date_add_interval item stored by the send_fields() function differs from item's result field type at the moment when the item is actually sent. It causes an assertion failure. Now the get_datetime_value() detects that the DATE value is returned by some item not only by checking the result field type but also by comparing the returned value with the 100000000L constant - any DATE value should be less than this value. Removed result field type adjusting code from the Item_date_add_interval::get_date() function.
[29 May 2007 20:36]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/27621 ChangeSet@1.2504, 2007-05-30 00:33:12+04:00, evgen@moonbone.local +4 -0 Bug#28450: The Item_date_add_interval in select list may fail the field type assertion. The bug was introduced by the patch for bug #16377. The "+ INTERVAL" (Item_date_add_interval) function detects its result type by the type of its first argument. But in some cases it returns STRING as the result type. This happens when, for example, the first argument is a DATE represented as string. All this makes the get_datetime_value() function misinterpret such result and return wrong DATE/DATETIME value. To avoid such cases in the fix for #16377 the code that detects correct result field type on the first execution was added to the Item_date_add_interval::get_date() function. Due to this the result field type of the Item_date_add_interval item stored by the send_fields() function differs from item's result field type at the moment when the item is actually sent. It causes an assertion failure. Now the get_datetime_value() detects that the DATE value is returned by some item not only by checking the result field type but also by comparing the returned value with the 100000000L constant - any DATE value should be less than this value. Removed result field type adjusting code from the Item_date_add_interval::get_date() function.
[4 Jun 2007 21:21]
Bugs System
Pushed into 5.1.20-beta
[4 Jun 2007 21:23]
Bugs System
Pushed into 5.0.44
[7 Jun 2007 17:06]
Jon Stephens
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release. If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at http://dev.mysql.com/doc/en/installing-source.html Documented bugfix in 5.0.44 and 5.1.20 changelogs.