Bug #4608 Views: View can have duplicate column names
Submitted: 18 Jul 2004 23:57 Modified: 21 Jul 2004 21:47
Reporter: Trudy Pelzer Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.1-alpha-debug OS:Linux (SuSE 8.2)
Assigned to: Oleksandr Byelkin CPU Architecture:Any

[18 Jul 2004 23:57] Trudy Pelzer
Description:
MySQL allows the creation of  a view with duplicate column names. This makes it impossible to specify the column one wants to retrieve later. For example, for the view definition below:

mysql> select * from v;
+---+---+
| a | a |
+---+---+
| a | a |
+---+---+
1 row in set (0.00 sec)

mysql> select a from v;
+---+
| a |
+---+
| a |
+---+
1 row in set (0.00 sec)
Which column a is being retrieved?

How to repeat:
create view v (a,a) as select 'a','a';
select * from v;
select a from v;
[19 Jul 2004 19:13] Aleksey Kishkin
verified on slackware 9
[21 Jul 2004 11:17] Oleksandr Byelkin
ChangeSet 
  1.1718 04/07/21 12:14:45 bell@sanja.is.com.ua +3 -0 
  test of duplicate field names (BUG#4608)
[21 Jul 2004 21:47] Oleksandr Byelkin
Thank you for bugreport. bug is fixed, patch is pushed into our source repository.