Bug #102832 | Column type returned by union is incorrect | ||
---|---|---|---|
Submitted: | 5 Mar 2021 16:59 | Modified: | 9 Mar 2021 8:18 |
Reporter: | Владислав Сокол | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: DML | Severity: | S3 (Non-critical) |
Version: | 5.7/8.0 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[5 Mar 2021 16:59]
Владислав Сокол
[5 Mar 2021 18:33]
MySQL Verification Team
Thank you for the bug report.
[9 Mar 2021 8:18]
Roy Lyseng
The claim on column names is correct. However the column types of a UNION is derived from the aggregation of the specific column from all branches of the UNION. Quoting from the manual: "Selected columns listed in corresponding positions of each SELECT statement should have the same data type. For example, the first column selected by the first statement should have the same type as the first column selected by the other statements. If the data types of corresponding SELECT columns do not match, the types and lengths of the columns in the UNION result take into account the values retrieved by all the SELECT statements. For example, consider the following, where the column length is not constrained to the length of the value from the first SELECT".