Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
Description
The code rewriting "datetime_field IS NULL" to "datetime_field='0000-00-00'" has tests for field_type():
class Item_func_isnull :public Item_func_null_predicate |
{
|
..
|
bool arg_is_datetime_notnull_field() |
{
|
Item **args= arguments();
|
if (args[0]->real_item()->type() == Item::FIELD_ITEM) |
{
|
Field *field=((Item_field*) args[0]->real_item())->field;
|
 |
if (((field->type() == MYSQL_TYPE_DATE) || |
(field->type() == MYSQL_TYPE_DATETIME)) &&
|
(field->flags & NOT_NULL_FLAG))
|
return true; |
}
|
..
|
};
|
COND *
|
Item_func_isnull::remove_eq_conds(THD *thd, Item::cond_result *cond_value,
|
bool top_level_arg)
|
{
|
..
|
if (((field->type() == MYSQL_TYPE_DATE) || |
(field->type() == MYSQL_TYPE_DATETIME)) &&
|
(field->flags & NOT_NULL_FLAG))
|
..
|
}
|
This is not friendly to new data types.
We'll remove these tests and add a new method in Type_handler_instead:
virtual bool cond_notnull_field_isnull_to_field_eq_zero() const |
{
|
return false; |
}
|
and override it for Type_handler_date_common and Type_handler_datetime_common to return true.
Attachments
Issue Links
- blocks
-
MDEV-4912 Data type plugin API version 1
- Closed