Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Inserting strings or byte arrays which exceed the builtin character limit for PLSQL VARCHAR2 variables causes failures. #102 fixes this issue for single inserts/merges. However, in batch inserts where some VARCHAR2 variables have been converted to LOBs and some have not, the subsequent UNION or RETURNING operations will fail due to inconsistent types.
This change was complicated to fix. Ultimately, it feels like the best thing to do in these scenarios is handle all LOB bulk inserts through PLSQL, where we have the ability to cast input/output as LOB types consistently across an entire column. In order to do that, we have to frontload the real type determination before choosing the code branch. I have attempted to do that in a way that only traverses and casts the createValues object once for efficiency. It will be a net efficiency loss for inserts/merges which do not end up needing PLSQL, though.
As part of testing this change, we found many other deficiencies in the PLSQL merge code path. For example, detecting conflict columns containing a primary key, as well as supporting JSON, UUIDs, boolean, and custom Valuer types in PLSQL. This PR fixes those cases and adds tests for those situations as well.
Type of change
How Has This Been Tested?
Numerous unit tests have been added which would fail without the proposed fixes.
Checklist: