[ 
https://issues.apache.org/jira/browse/FLINK-33490?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17789494#comment-17789494
 ] 

lincoln lee commented on FLINK-33490:
-------------------------------------

Here're my two cents: from my previous reference to the sql standard, it 
forbids two elements at different positions from having equivalent names, 
especially when created through a sql schema statement, but I didn't find any 
specific recommendations for the query part, this is also consistent with 
testing provided by the [~xuyangzhong], these rdbms are indeed allowed 
duplicate columns in select statement(select * from t1 l, t1 r).
So, for the create view statements involved in this issue, I would prefer to 
keep the behavior consistent with all the create statements (create 
[materialized] view / table [as query]) and follow the standard.
I'm fine with initiating a FLIP or not.


> Validate the name conflicts when creating view
> ----------------------------------------------
>
>                 Key: FLINK-33490
>                 URL: https://issues.apache.org/jira/browse/FLINK-33490
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Planner
>    Affects Versions: 1.19.0
>            Reporter: Shengkai Fang
>            Assignee: xuyang
>            Priority: Major
>              Labels: pull-request-available
>
> We should forbid 
> ```
> CREATE VIEW id_view AS
> SELECT id, uid AS id FROM id_table
> ```
> As the SQL standards states,
> If <regular view specification> is specified, then:
> i) If any two columns in the table specified by the <query expression> have 
> equivalent <column name>s, or if any column of that table has an 
> implementation-dependent name, then a <view column list> shall be specified.
> ii) Equivalent <column name>s shall not be specified more than once in the 
> <view column list>.
> Many databases also throw exception when view name conflicts, e.g. mysql, 
> postgres.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to