[ 
https://issues.apache.org/jira/browse/CAMEL-24044?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen updated CAMEL-24044:
--------------------------------
    Priority: Major  (was: Critical)

> camel-sql - Postgres aggregation repositories fail on insert: version bound 
> without a placeholder
> -------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-24044
>                 URL: https://issues.apache.org/jira/browse/CAMEL-24044
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-sql
>            Reporter: Federico Mariani
>            Assignee: Federico Mariani
>            Priority: Major
>
> PostgresAggregationRepository.insert() builds {{INSERT INTO t(exchange, id[, 
> body][, headers...]) VALUES (...) ON CONFLICT DO NOTHING}} without the 
> {{version}} column, but delegates to the base {{insertHelper}} which binds 
> blob(1), key(2), version(3)[, body(4), ...] - one more bound parameter than 
> placeholders. Every {{add()}} fails with {{The column index is out of range: 
> 3, number of columns: 2}} (verified against a real PostgreSQL instance). With 
> {{storeBodyAsText=true}} the version long is bound into the {{body}} 
> placeholder before the failure.
> ClusteredPostgresAggregationRepository has the same defect in its 
> completed-table insert: {{add()}} works (it goes through the base insert), 
> but every {{remove()}} fails when moving the aggregated exchange to the 
> completed table - i.e. every aggregation blows up at completion. In addition 
> it never appends the {{INSTANCE_ID}} column that 
> {{ClusteredJdbcAggregationRepository.insertHelper}} binds when 
> {{recoveryByInstance=true}}, so instance-scoped recovery could never match 
> {{scan()}}.
> Broken since the CAMEL-7810 optimistic locking refactor (Camel 3.4); neither 
> class has any test coverage. Fix: include the {{version}} column (and 
> {{INSTANCE_ID}} for the clustered variant when applicable) in the Postgres 
> INSERT statements, add integration tests against real PostgreSQL, and update 
> the stale PostgreSQL schema in the component documentation.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to