DB2 - DbJson length, treat length = 4000+ as LOB type for DB2 #3354
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.
Hello @rbygrave,
this fixes the
I've bisected and it was introduced by this commit: 11c9bdf because it changes
EBasicJsonMap.content
property from@DbJson
toThe problem is, that a field with value of length 5000 is no longer detected as lob. And lob fields are not allowed in DB2 distinct queries...
We've added a workaround for this some time ago: #2511
Unfortunately, the detection mechanism is not precise enough. So as quick workaround (!) I added to the "isDbLob" a check if the
dbLength > 255
I'm not happy with this check, because there is also a "use best type detection" here: #3107 so that lengths > 4000 are mapped to lob instead to varchar.
So from DB2 perspective, it would be better to use
dbLength > 4000
as fix ?I could either refactor the whole "unselectLobs" code to "unselectLobsForDb2". "isDbLob" -> "isDb2Lob" ans so on. So I can use hard coded values.
(All in all, distincts and lobs are very annoying in DB2 and it seems that this is really only needed for DB2 and maybe Oracle? - see comment here)
OR
I find a way to determine the exact DDL type from a BeanProperty, but this is not easily to determine, because it is hidden in "renderDbType" and so on.
in short words, the easiest fix would be to assume that a DbJson is a lob if
dbLength > 4000
. What do you think about this?cheers
Roland