{"record":{"id":"78daac8899cc4770","repo":"apache/seatunnel","slug":"unsupported-syntax-s","errorCode":null,"errorMessage":"Unsupported syntax: %s","messagePattern":"Unsupported syntax: (.+?)","errorType":"exception","errorClass":"ParserException","httpStatus":null,"severity":"error","filePath":"seatunnel-config/seatunnel-config-sql/src/main/java/org/apache/seatunnel/config/sql/SqlConfigBuilder.java","lineNumber":354,"sourceCode":"                throw new ParserException(\n                        String.format(\"The source table[%s] is not found\", pluginInputIdentifier));\n            }\n\n            String pluginOutputIdentifier = createTable.getTable().getName();\n            if (sqlTables.containsKey(pluginOutputIdentifier)) {\n                throw new ParserException(\n                        String.format(\"Table name duplicate: %s\", pluginOutputIdentifier));\n            }\n            sqlTables.put(pluginOutputIdentifier, transformConfig);\n\n            String query = select.toString();\n            transformConfig.setPluginInputIdentifier(pluginInputIdentifier);\n            transformConfig.setPluginOutputIdentifier(pluginOutputIdentifier);\n            transformConfig.setQuery(query);\n\n            return transformConfig;\n        } else {\n            throw new ParserException(String.format(\"Unsupported syntax: %s\", createTable));\n        }\n    }\n\n    private static void parseInsertSql(\n            Insert insertSql,\n            Map<String, BaseConfig> sqlTables,\n            SeaTunnelConfig seaTunnelConfig,\n            AtomicInteger tempTableIndex) {\n        if (insertSql.getColumns() != null && !insertSql.getColumns().isEmpty()) {\n            throw new ParserException(\"Insert sql must not have columns\");\n        }\n        TransformConfig transformConfig = new TransformConfig();\n        Select select = insertSql.getSelect();\n        if (select == null\n                || select.getSelectBody() == null\n                || !(select.getSelectBody() instanceof PlainSelect)) {\n            throw new ParserException(\"Insert sql must have select statement\");\n        }","sourceCodeStart":336,"sourceCodeEnd":372,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-config/seatunnel-config-sql/src/main/java/org/apache/seatunnel/config/sql/SqlConfigBuilder.java#L336-L372","documentation":"Thrown by parseCreateAsSql when a CREATE TABLE statement does not contain a SELECT body (the AS SELECT part is missing or is not a plain SELECT). The SQL config builder only supports CREATE TABLE ... AS SELECT as the transform form of DDL.","triggerScenarios":"Writing plain CREATE TABLE without 'AS SELECT ...' but expecting SQL-style config; using a non-PlainSelect body (e.g. UNION, WITH/CTE) that the parser cannot handle here.","commonSituations":"Users translating Flink/Spark DDL directly; defining a sink schema with CREATE TABLE (columns) without AS SELECT; using CTE syntax in the CTAS.","solutions":["Append 'AS SELECT ...' to the CREATE TABLE statement","Define schema-only tables via a SELECT from an existing source instead of column lists","Rewrite CTE/UNION queries into a plain single SELECT"],"exampleFix":"// before\nCREATE TABLE t2 (id INT)\n// after\nCREATE TABLE t2 AS SELECT id FROM t1","handlingStrategy":"validation","validationCode":"// verify every CREATE TABLE has an AS SELECT plain query\nif (!sql.matches(\"(?s).*CREATE\\\\s+TABLE\\\\s+\\\\w+\\\\s+AS\\\\s+SELECT\\\\s+.*\")) {\n    throw new IllegalArgumentException(\"CREATE TABLE statements must be of form CREATE TABLE t AS SELECT ... (single plain SELECT)\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    SeaTunnelConfig c = SqlConfigBuilder.of(sql);\n} catch (ParserException e) {\n    if (e.getMessage().startsWith(\"Unsupported syntax:\")) {\n        // rewrite DDL as CTAS with a plain SELECT\n    }\n}","preventionTips":["Never use schema-only CREATE TABLE (column lists) in this dialect","Avoid CTEs/UNION in the CTAS; use a plain single SELECT","Port Flink/Spark DDL by converting it to CTAS form"],"tags":["sql","parser","unsupported-syntax"],"backgroundTag":"unsupported-operation","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}