| Bug #76095 | CREATE VIEW with UNION does not allow duplicate column names in version 5.5.40 | ||
|---|---|---|---|
| Submitted: | 2 Mar 2015 13:29 | Modified: | 2 Mar 2015 18:12 |
| Reporter: | Anders Jensen | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | MySQL Server: Views | Severity: | S3 (Non-critical) |
| Version: | 5.5.40 | OS: | MacOS (10.10.2) |
| Assigned to: | CPU Architecture: | Any | |
[2 Mar 2015 18:12]
MySQL Verification Team
Actually, this is not a bug but a consequence of the change introduced in the version 5.5.39. This change was necessary, because, as reported in the bug # 65388, a view like the one that you reported can, in some cases, lead to the wrong syntax in the file produced by the mysqldump. Hence, not a bug.

Description: When creating a view with a union, duplicate column names are no longer alllowed. I searched the changes log from version 5.5.37 (where it is allowed) to version 5.5.40 (where I observed the bug) but could not find anything to explain this change of behaviour. It means that a mysqldump created by fx 5.5.37 (which will add the duplicate aliases) will not be able to be restored on a 5.5.40 server. How to repeat: In version 5.5.37, this will work (and fail in version 5.5.40): CREATE VIEW foo AS SELECT NULL AS `foo`, NULL AS `bar`, NULL AS `baz` UNION SELECT NULL AS `NULL`, NULL AS `NULL`, NULL AS `NULL`; But in version 5.5.40, you would have to remove the aliases like this to get it working: CREATE VIEW foo AS SELECT NULL AS `foo`, NULL AS `bar`, NULL AS `baz` UNION SELECT NULL, NULL, NULL;