| Bug #108790 | Invisible column's default values is invalid if not specify other columns | ||
|---|---|---|---|
| Submitted: | 15 Oct 2022 16:46 | Modified: | 17 Oct 2022 6:55 |
| Reporter: | Cheng Zhou | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: DML | Severity: | S2 (Serious) |
| Version: | 8.0.30 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[15 Oct 2022 16:46]
Cheng Zhou
[15 Oct 2022 18:21]
Cheng Zhou
in function:
bool Sql_cmd_insert_values::execute_inner(THD *thd) {
....
/*
We have three alternative syntax rules for the INSERT statement:
1) "INSERT (columns) VALUES ...", so non-listed columns need a default
2) "INSERT VALUES (), ..." so all columns need a default;
note that "VALUES (),(expr_1, ..., expr_n)" is not allowed, so checking
emptiness of the first row is enough
3) "INSERT VALUES (expr_1, ...), ..." so no defaults are needed; even if
expr_i is "DEFAULT" (in which case the column is set by
Item_default_value::save_in_field_inner()).
*/
const bool manage_defaults = column_count > 0 || // 1)
value_count == 0; // 2)
....
}
--------------------------------------------------------------------
Fail to take into account invisible columns when set manage_defaults.
[17 Oct 2022 6:55]
MySQL Verification Team
Hello Cheng Zhou, Thank you for the report and test case. Verified as described. regards, Umesh
