Yongqian Wang created CALCITE-2246:

             Summary: column alias in view will cause duplicate column 
                 Key: CALCITE-2246
                 URL: https://issues.apache.org/jira/browse/CALCITE-2246
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.16.0
         Environment: using mysql 5.7 database
            Reporter: Yongqian Wang
            Assignee: Julian Hyde


I have a view like this , testdb is a mysql datasource , i have a view with a 
join statements
      "name": "test",
      "type": "view",
      "sql": [
        "select t0.\"id\" as \"id\", t0.\"name\" as name from TESTDB.\"a\" t0 
left join TESTDB.\"b\" t1 on t0.\"id\" = t1.\"id\""  
when i try to execute query like "select * from test.view limit 1", i got this 
java.sql.SQLException: exception while executing query: while executing SQL 
[SELECT `t1`.`id`, `t1`.`name` AS `NAME`
FROM `a`) AS `t`
FROM `b`) AS `t0` ON `t`.`id` = `t0`.`id`) AS `t1`]

Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Duplicate 
column name 'id'

which t1 return two "id" column

This message was sent by Atlassian JIRA

Reply via email to