davsclaus opened a new pull request, #27685: URL: https://github.com/apache/camel/pull/27685
https://issues.apache.org/jira/browse/CAMEL-25557 In the local-model benchmark the connect-service-sql step that registers customers (insert, or add one to the order count of a customer already there) failed in 7 of 13 runs. The datasource of the example is PostgreSQL (`spring.datasource.url=jdbc:postgresql:...`), and the model wrote: - `INSERT ... ON DUPLICATE KEY UPDATE orders = orders + 1` (MySQL): a syntax error for every file, 80-90 runtime errors, then other dialects until it ran out of tool calls; - `ON CONFLICT (id) DO UPDATE SET country = :#excluded.country`: `EXCLUDED` is PostgreSQL's row being inserted, as a camel-sql named parameter it is a key looked up in the body and the headers. Now, for a YAML route validated with its directory (camel_write_file, camel_validate_source): - With `application.properties` pointing to one PostgreSQL datasource, `INSERT ... ON DUPLICATE KEY UPDATE` says so and gives the statement to write, the key taken from a `CREATE TABLE ... PRIMARY KEY` in the same file when there is one: `write INSERT INTO customers (id, country, orders) VALUES (:#customer, :#country, 1) ON CONFLICT (id) DO UPDATE SET orders = customers.orders + 1, country = EXCLUDED.country` The other way round for a MySQL or MariaDB datasource and `ON CONFLICT ... DO UPDATE`. No datasource, or more than one, says nothing. - `:#excluded.column` says to write `EXCLUDED.column` without `:#`. Tests: `SqlDialectChecksTest`; camel-jbang-core suite 1757 tests, no failures. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01STT6whBgK1AqsSsUKrnE8m -- 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]
