-
Nisha Gopalakrishnan authored
Analysis ======== CREATE TABLE..SELECT generates zero date as default value for temporal columns in STRICT, NO_ZERO_DATE mode when the columns are not based on source table columns directly. CREATE TABLE..SELECT generates implicit default values for columns without a default value which in case of temporal columns contains zero date component. The implict defaults generated are marked as explicit default value (because the flag 'NO_DEFAULT_VALUE_FLAG' is not set), thus skipping the checks which validate the default value based on the SQL mode. Hence tables with zero date are created in strict mode. Fix === The function "create_table_from_items()" has been modified to mark columns having date component which are based on expressions and not source table columns directly as having no default value in strict mode i.e 'NO_DEFAULT_VALUE_FLAG' flag is set in such cases. This ensures that tables are created without zero date as default value.
Nisha Gopalakrishnan authoredAnalysis ======== CREATE TABLE..SELECT generates zero date as default value for temporal columns in STRICT, NO_ZERO_DATE mode when the columns are not based on source table columns directly. CREATE TABLE..SELECT generates implicit default values for columns without a default value which in case of temporal columns contains zero date component. The implict defaults generated are marked as explicit default value (because the flag 'NO_DEFAULT_VALUE_FLAG' is not set), thus skipping the checks which validate the default value based on the SQL mode. Hence tables with zero date are created in strict mode. Fix === The function "create_table_from_items()" has been modified to mark columns having date component which are based on expressions and not source table columns directly as having no default value in strict mode i.e 'NO_DEFAULT_VALUE_FLAG' flag is set in such cases. This ensures that tables are created without zero date as default value.
Loading