[
https://issues.apache.org/jira/browse/FLINK-32958?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17759534#comment-17759534
]
Han commented on FLINK-32958:
-----------------------------
[~yesorno] Yes, CTAS is a good alternative, thanks~
But I still insist on providing CREATE TABLE LIKE VIEW for the convenience of
users.
Is there any other reason why this syntax cannot be provided?
> Support VIEW as a source table in CREATE TABLE ... Like statement
> -----------------------------------------------------------------
>
> Key: FLINK-32958
> URL: https://issues.apache.org/jira/browse/FLINK-32958
> Project: Flink
> Issue Type: Improvement
> Components: Table SQL / Planner
> Affects Versions: 1.17.1
> Reporter: Han
> Priority: Major
> Labels: pull-request-available
>
> We can't create a table from a view through CREATE TABLE LIKE statement
>
> case 1:
> {code:sql}
> create view source_view as select id,val from source;
> create table sink with ('connector' = 'print') like source_view (excluding
> all);
> insert into sink select * from source_view;{code}
> case 2
> {code:java}
> DataStreamSource<Entity> source = ...;
> tEnv.createTemporaryView("source", source);
> tEnv.executeSql("create table sink with ('connector' = 'print') like source
> (excluding all)");
> tEnv.executeSql("insert into sink select * from source");{code}
>
> The above cases will throw an exception:
> {code:java}
> Source table '`default_catalog`.`default_database`.`source`' of the LIKE
> clause can not be a VIEW{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)