[MDEV-15704] Fix Item_param::basic_const_item() to return true for temporal bound values Created: 2018-03-28 Updated: 2020-05-05 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Data types |
| Affects Version/s: | 10.3 |
| Fix Version/s: | 10.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Alexander Barkov | Assignee: | Alexander Barkov |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Epic Link: | Data type cleanups |
| Description |
|
There is an asymmetry for temporal data types in Item_param:
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. This asymmetry affects negatively various aspects, for example, constant propagation may not work as efficient, as for other data types. Also, in this example:
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.:
In this example, the default integer value 10 is stored in the FRM as an expression rather than a constant. |