Skip to content

Use safe in() lists for id collections in the variable queries - #4277

Merged
filiphr merged 1 commit into
flowable:mainfrom
filiphr:variable-query-safe-in-lists
Sep 17, 2026
Merged

filiphr merged 1 commit into
flowable:mainfrom
filiphr:variable-query-safe-in-lists

Conversation

@filiphr

@filiphr filiphr commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

The variable queries emitted a single flat in() clause for the id collections, which fails on databases that limit the number of entries in an in() clause (Oracle allows at most 1000).

The id collections are now split into chunks of MAX_ENTRIES_IN_CLAUSE and combined with OR, the same way the historic variable query already did it for some of its filters. This covers taskIds, executionIds, scopeIds and subScopeIds on InternalVariableInstanceQuery, taskIds and executionIds on VariableInstanceQuery, and executionIds on HistoricVariableInstanceQuery, which was the last filter in that query still using a flat in() clause. The scopeTypes and names collections are not expected to exceed the limit and are left as they are.

While there, the cached entity matcher now ignores empty scopeIds and subScopeIds collections, so it is consistent with the SQL, which skips the filter in that case.

The variable queries emitted a single flat in() clause for the id
collections, which fails on databases that limit the number of entries
in an in() clause (Oracle allows at most 1000).

The id collections are now split into chunks of MAX_ENTRIES_IN_CLAUSE
and combined with OR, the same way the historic variable query already
did it for some of its filters. This covers taskIds, executionIds,
scopeIds and subScopeIds on InternalVariableInstanceQuery, taskIds and
executionIds on VariableInstanceQuery, and executionIds on
HistoricVariableInstanceQuery, which was the last filter in that query
still using a flat in() clause. The scopeTypes and names collections are
not expected to exceed the limit and are left as they are.

While there, the cached entity matcher now ignores empty scopeIds and
subScopeIds collections, so it is consistent with the SQL, which skips
the filter in that case.
@filiphr
filiphr merged commit c72f396 into flowable:main Sep 17, 2026
3 checks passed
@filiphr
filiphr deleted the variable-query-safe-in-lists branch September 17, 2026 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant