On Tue, 13 Oct 2026 17:25:49 GMT, Justin Lu <[email protected]> wrote:

> This PR fixes a bug in `CachedRowSet` when insertion into a table with more 
> primary key columns than columns selected by the row set causes 
> `ArrayIndexOutOfBoundsException`.
> 
> This occurs because the code erroneously allocates the `primaryKeys` array to 
> size `icolCount`. So if there are more pks than cols selected, the code will 
> naturally index an out of bounds index in the array. Instead, the code should 
> use an `ArrayList` because the count of the pks is not yet known. This is 
> also hinted at considering the previous code was incrementing a `k` to figure 
> out the key size.
> 
> We can also process the primary keys such that they are only built once 
> instead of building them for every single row for a given `writeData` op.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Hi Justin

Thank you for tackling this.  The changes look reasonable  as well as cleaning 
up the un-needed querying for the PKs

-------------

Marked as reviewed by lancea (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/33350#pullrequestreview-5587508322

Reply via email to