List:General Discussion« Previous MessageNext Message »
From:Terence Date:October 7 2005 7:49am
Subject:Duplicate column error when creating view on 5.0.13
View as plain text  
Hi All,

I get a duplicate column error on 5.0.13 when creating a view. Am I 
doing something wrong here or do I submit a bug report? This should be 
allowed as the col names
are not duplicated.

Reproduce:

create table `ticket_master` (
`ticket_id` int (5) NOT NULL AUTO_INCREMENT ,
`category_id` int (5) NULL,
PRIMARY KEY ( `ticket_id` ));

create table `category_master` (
`category_id` int (5) NOT NULL AUTO_INCREMENT ,
`category_name` varchar (20) NULL,
PRIMARY KEY ( `ticket_id` ));

CREATE VIEW `v_tickets` AS
(
SELECT * FROM ticket_master tm, category_master cm
WHERE tm.category_id = cm.category_id
);

ERROR 1060 : Duplicate column name 'category_id'

Nothing wrong with the query as you can see

SELECT * FROM ticket_master tm, category_master cm
WHERE tm.category_id = cm.category_id;
+-----------+-------------+-------------+---------------+
| ticket_id | category_id | category_id | category_name |
+-----------+-------------+-------------+---------------+
|         1 |           1 |           1 | test          |
+-----------+-------------+-------------+---------------+
1 row in set

Thanks
Thread
Duplicate column error when creating view on 5.0.13Terence7 Oct
  • Re: Duplicate column error when creating view on 5.0.13Johan Höök7 Oct
    • Re: Duplicate column error when creating view on 5.0.13Terence7 Oct
      • Re: Duplicate column error when creating view on 5.0.13Johan Höök7 Oct
  • Re: Duplicate column error when creating view on 5.0.13Martijn Tonies7 Oct
  • Re: Duplicate column error when creating view on 5.0.13SGreen7 Oct
    • Re: Duplicate column error when creating view on 5.0.13Terence10 Oct