Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.3(EOL)
-
None
Description
There is an asymmetry for temporal data types in Item_param:
bool Item_param::basic_const_item() const |
{
|
DBUG_ASSERT(fixed || state == NO_VALUE);
|
if (state == NO_VALUE || |
(state == SHORT_DATA_VALUE && type_handler()->cmp_type() == TIME_RESULT))
|
return FALSE; |
return TRUE; |
}
|
Notice, unlike for other data types, basic_const_item() returns false for bound temporal values.
The reason for this was probably because prior to 10.0 we didn't have Item_temporal_literal (and its descendants) so that Item_param::clone_item() could not return a basic constant for temporal values.
Now this asymmetry can be fixed, so Item_param::clone_item() returns non-NULL values for all data types.
This asymmetry affects negatively various aspects, for example, constant propagation may not work as efficient, as for other data types.
Also, in this example:
EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 (a TIME DEFAULT ?)' USING TIME'10:10:10'; |
the default value is stored in the FRM as an expression rather than a constant (its visible if one opens the frm in a text editor).
For non-temporal data types, Item_param used in DEFAULT clause is converted to constants, e.g.:
EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 (a INT DEFAULT ?)' USING 10; |
In this example, the default integer value 10 is stored in the FRM as an expression rather than a constant.