[Bug][Connector-V2] Generated JDBC Sink SQL fails for special field names
Search before asking
- Searched existing issues and PRs. #12501 covers DuckDB identifier quoting; this is the separate downstream shared parameter-binding failure.
What happened
On current dev b2045b14c, generated JDBC Sink SQL can quote a column correctly and still fail in FieldNamedPreparedStatement.prepareStatement:
CREATE TABLE target ("field?question" INTEGER);
INSERT INTO target ("field?question") VALUES (:field?question);The implementation uses sql.contains("?") to select positional binding, so it sends the named SQL unchanged to the driver. Fields containing spaces, colons or double quotes are instead truncated by the parameter-name regex. Repeated/reordered parameters also fail when a name contains ?.
Expected behavior
Generated placeholders should resolve against complete upstream field names, preserving repeated bindings and unused/reordered source fields. Literal or quoted-identifier text must not select positional binding. Configured positional query SQL should retain its existing SQL and field-order binding, including dialect-specific literal escaping.
Reproduction
Using the project's DuckDB JDBC 1.3.1.0, the existing test class extended with actual prepare/bind/execute cases produces 7 errors in 12 tests before the fix: four field-name cases, repeated/reordered binding, quoted-text interference, and a named parameter followed by ::INTEGER. The positional and unknown-name controls pass. The generated Source → Sink factory flow with space/colon/question-mark fields also exercises the affected path.
Version
Current dev only; this report does not establish a released-version range or backport request. Correct target-dialect identifier quoting is still necessary; #12501 remains separate. This is not a DuckLake upsert, XA, or exactly-once request.
Source: apache/seatunnel