[ https://issues.apache.org/jira/browse/FLINK-36038?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
ASF GitHub Bot updated FLINK-36038: ----------------------------------- Labels: pull-request-available (was: ) > SHOW CREATE VIEW returns invalid query > -------------------------------------- > > Key: FLINK-36038 > URL: https://issues.apache.org/jira/browse/FLINK-36038 > Project: Flink > Issue Type: Bug > Components: Table SQL / API > Affects Versions: 1.20.0 > Reporter: Sergey Nuyanzin > Assignee: Sergey Nuyanzin > Priority: Major > Labels: pull-request-available > > especially for views with comments > for instance > 1. create view > {code:sql} > CREATE VIEW v1 COMMENT 'test view' AS SELECT 1, 'a'; > {code} > 2. show create > {code:sql} > SHOW CREATE VIEW v1; > {code} > it returns query > {code:sql} > CREATE VIEW `default_catalog`.`default_database`.`v1`(`EXPR$0`, `EXPR$1`) as > SELECT 1, 'a' COMMENT 'test view' > {code} > now if we try to execute it fails as > {noformat} > [ERROR] Could not execute SQL statement. Reason: > org.apache.flink.sql.parser.impl.ParseException: Incorrect syntax near the > keyword 'COMMENT' at line 2, column 15. > Was expecting one of: > <EOF> > "AS" ... > "EXCEPT" ... > {noformat} > the reason is that {{COMMENT}} should be before the query according to syntax > mentioned at > https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/create/#create-view -- This message was sent by Atlassian Jira (v8.20.10#820010)