Skip to content

CAY-3079 IN qualifier binds each byte of a binary value as a separate parameter - #660

Open
Jugen wants to merge 1 commit into
STABLE-5.0from
binary-key-in-list-binding
Open

Jugen wants to merge 1 commit into
STABLE-5.0from
binary-key-in-list-binding

Conversation

@Jugen

@Jugen Jugen commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Problem: An IN qualifier with byte[] values on a binary column produces one ? per byte. This covers inDbExp(..), disjointById() to-one prefetches over several keys, and to-many disjointById() from several binary-key masters. The result is a SQL error, as on HSQLDB, or no matches.

Cause: In ValueNode.appendValue, the array branch expands every byte[] into its bytes, including the elements of an Object[] IN list.

Fix: When the node’s DbAttribute is binary (TypesMapping.isBinary(): BINARY, VARBINARY, LONGVARBINARY, BLOB), a byte[] is bound as one value. Other byte[] values expand as before. Also, HierarchicalObjectResolver now deduplicates disjointById IN values by content, so equal binary keys from different rows aren’t repeated.

Tests: New ValueNodeTest (placeholders and bindings, plus the expansion that is kept) and DataContextBinaryPKInListIT.

Related: attaching the to-one prefetch result over binary keys is fixed separately in CAY-3078.

@Jugen
Jugen marked this pull request as ready for review November 16, 2026 17:04
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