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

Paul Lin commented on FLINK-24948:
----------------------------------

[~jark] Sure. For example, a table name tbl_a with schema `(.a varchar(64))` 
would result in a statement like `insert into tbl_a (`.a`) values (:.a)` (in 
which the columns names are quoted, for you 2nd question). The statement would 
be further processed by `FieldNamedPreparedStatementImpl`, in which the named 
parameter would be extracted by `:` (the delimiter) and characters that are no 
part of Java identifiers, see 
[code|https://github.com/apache/flink/blob/e431e6b686e904b6b6f6dabfed8796c67898461b/flink-connectors/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/statement/FieldNamedPreparedStatementImpl.java#L223].

I think the problem lies in the parsing of named parameters, as it simply 
extracts the names via some reserved characters, but these characters can also 
be part of a valid column name.

> Special character in column names breaks JDBC statement parsing
> ---------------------------------------------------------------
>
>                 Key: FLINK-24948
>                 URL: https://issues.apache.org/jira/browse/FLINK-24948
>             Project: Flink
>          Issue Type: Bug
>          Components: Connectors / JDBC
>    Affects Versions: 1.12.4
>            Reporter: Paul Lin
>            Assignee: Paul Lin
>            Priority: Major
>
> Currently, JDBC connector assumes columns names respect Java identifier 
> naming restrictions, but Databases that support JDBC may have different 
> naming restrictions. For example, MySQL allows dots and colons in column 
> names. In that case, JDBC connector would have trouble parsing the SQL.
> We could fix this by validating field names in `JdbcDmlOptions`. In addition, 
> it'd be good to clarify the naming restrictions of Flink SQL, so users and 
> connector developers would know the standard.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to