Flink SQL 关键字 user?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Flink SQL 关键字 user?

deadwind4
我发现我创建表 字段名为 user会报错。 user是关键字吗,还是其他原因


"CREATE TABLE ods_foo (\n" +
"    id INT,\n" +
"    user ARRAY<ROW<name STRING>>\n" +
") WITH (

Exception in thread "main" org.apache.flink.table.api.SqlParserException: SQL parse failed. Encountered "user" at line 3, column 5.
Was expecting one of:



Reply | Threaded
Open this post in threaded view
|

Re: Flink SQL 关键字 user?

Benchao Li-2
是的,user是关键字,关键字列表可以参考[1].

如果遇到关键字,可以使用 ` 来处理,比如:
CREATE TABLE `user` (...) WITH (...);

[1]
https://ci.apache.org/projects/flink/flink-docs-master/dev/table/sql/#reserved-keywords

王 outlook <[hidden email]> 于2020年7月6日周一 下午5:07写道:

> 我发现我创建表 字段名为 user会报错。 user是关键字吗,还是其他原因
>
>
> "CREATE TABLE ods_foo (\n" +
> "    id INT,\n" +
> "    user ARRAY<ROW<name STRING>>\n" +
> ") WITH (
>
> Exception in thread "main" org.apache.flink.table.api.SqlParserException:
> SQL parse failed. Encountered "user" at line 3, column 5.
> Was expecting one of:
>
>
>
>

--

Best,
Benchao Li
Reply | Threaded
Open this post in threaded view
|

Re: Flink SQL 关键字 user?

Leonard Xu
In reply to this post by deadwind4
Hi,
是的,用`user`转义处理下,
完整的保留关键字参考[1]

Best,
Leonard
[1] https://ci.apache.org/projects/flink/flink-docs-master/dev/table/sql/ <https://ci.apache.org/projects/flink/flink-docs-master/dev/table/sql/>

> 在 2020年7月6日,17:06,王 outlook <[hidden email]> 写道:
>
> "CREATE TABLE ods_foo (\n" +
> "    id INT,\n" +
> "    user ARRAY<ROW<name STRING>>\n" +
> ") WITH (