-
Notifications
You must be signed in to change notification settings - Fork 695
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: EXPOSED-116 UUID conversion error with upsert in H2 (#1823)
Using a UUID column as a key constraint in H2's MERGE INTO -- USING statement was failing with: org.h2.jdbc.JdbcSQLDataException: Data conversion error converting "U&'\\fffdK\\fffdS\\001bJr\\fffdG%\\fffdE\\00100\\fffd' (TESTER: ""ID"" UUID NOT NULL)"; This error occurs because the statement uses a derived column list to merge ON (T.ID=S.ID), so the UUID as a ByteArray in T.ID needs to be converted internally to compare with the String in S.ID. This error goes away if a regular integer id column is used or if the key constraint is swapped with another. The error also goes away if the identical MERGE statement is placed in an exec() directly, indicating that the issue lies with how Exposed sends UUID values to the H2 database. Switching the sent value from a ByteArray to a String allows comparison without conversion. A String is still one of 3 acceptable ways to store a UUID in H2 and sending a String still results in a UUID being retrieved back from the database.
- Loading branch information
Showing
3 changed files
with
52 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters