FirebirdSQL / jaybird

JDBC driver for Firebird
https://firebirdsql.org/en/jdbc-driver/
GNU Lesser General Public License v2.1
93 stars 23 forks source link

FBRowUpdater incorrectly considers result set with only partial PK updatable #780

Closed mrotteveel closed 10 months ago

mrotteveel commented 10 months ago

When FBRowUpdater generates its parameter mask, it checks if it found the 'best row identifier', but unfortunately, it fails to reset the boolean used to track that. As a result, if a table has a composite PK, and the prefix of the primary key is included in the query (i.e. first, or first + second, etc), but the suffix is missing (e.g. last, or second last + last, etc.), it will still consider the result set updatable.

Subsequent attempts to update rows through the result may update multiple rows (and refresh row will fail with an exception).

This has been broken since 3.0.0, and no one has reported it, so initially, it will only be fixed in Jaybird 6.

mrotteveel commented 10 months ago

Decided that the (minimal) fix should be backported to Jaybird 5, see #781