Bug #74539 view creation with named columns, over union, is rejected
Submitted: 24 Oct 2014 8:40 Modified: 23 Jul 2015 18:27
Reporter: Guilhem Bichot Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DDL Severity:S3 (Non-critical)
Version:5.6.20 OS:Any
Assigned to: CPU Architecture:Any

[24 Oct 2014 8:40] Guilhem Bichot
Description:
When working on http://bugs.mysql.com/bug.php?id=74496
noticed this:

create view v (vv,ww) as SELECT 1 AS a, 2 AS b UNION ALL  SELECT 1 AS a, 1 AS a;
ERROR 1060 (42S21): Duplicate column name 'a'

this should be accepted.

How to repeat:
create view v (vv,ww) as SELECT 1 AS a, 2 AS b UNION ALL  SELECT 1 AS a, 1 AS a;
[23 Jul 2015 18:27] Paul DuBois
Noted in 5.5.46, 5.6.27, 5.7.9, 5.8.0 changelogs.

View creation from a UNION failed with a duplicate-column error if
multiple SELECT statements in the UNION used the same column name.
[24 Jul 2015 12:57] Paul DuBois
Revised changelog entry:

View creation from a UNION failed with a duplicate-column error if a
SELECT statement in the UNION other than the first used the same
column name multiple times.