zhangshenghang opened a new issue, #12520:
URL: https://github.com/apache/seatunnel/issues/12520
### Description
The JDBC sink parses named parameters (`:name`) in user SQL with the regular
expression `:([\p{L}\p{Nl}\p{Nd}\p{Pc}\$\-.@%&*#~!?^+=<>|]+)` in
`FieldNamedPreparedStatement#parseNamedStatement`. The character class covers
most special characters, but it does not include whitespace.
When a sink column name contains a space (some legacy databases do use such
names, e.g. `MY COL`), the parser cuts the token at the space:
```
INSERT INTO test (first_name, last_name) VALUES (:first name, :last name)
```
`":first name"` is parsed as parameter `first` and the parsed SQL becomes
`VALUES (? name, ? name)`, so statement creation either fails the parameter
validation or produces a broken statement.
Expected: when the schema field list is known (the sink always knows it), a
field name containing characters outside the regex class should be matched as a
whole-name placeholder.
### Impact
JDBC sink jobs with custom `query`/upsert SQL and space-containing column
names cannot run.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]