[jOOQ/jOOQ#13643] Wrong result column type for requested conversion when reading JSONB_ARRAY nested in ROW in DB2

This commit is contained in:
Lukas Eder 2022-06-08 10:57:04 +02:00
parent 9672f84197
commit afc404eb44
2 changed files with 18 additions and 2 deletions

View File

@ -193,7 +193,7 @@ implements
default: {
JSONNull jsonNull;
JSONReturning jsonReturning = new JSONReturning(returning);
JSONReturning jsonReturning;
// Workaround for https://github.com/h2database/h2database/issues/2496
if (ctx.family() == H2 && fields.isEmpty())
@ -201,6 +201,14 @@ implements
else
jsonNull = new JSONNull(onNull);
jsonReturning = new JSONReturning(returning);
Field<T> jsonArray = CustomField.of(N_JSON_ARRAY, getDataType(), c ->
c.visit(N_JSON_ARRAY).sql('(').visit(QueryPartListView.wrap(mapped, jsonNull, jsonReturning).separator("")).sql(')')
);

View File

@ -221,7 +221,7 @@ implements
private final void acceptStandard(Context<?> ctx) {
JSONNull jsonNull;
JSONReturning jsonReturning = new JSONReturning(returning);
JSONReturning jsonReturning;
// Workaround for https://github.com/h2database/h2database/issues/2496
if (entries.isEmpty() && ctx.family() == H2)
@ -234,6 +234,14 @@ implements
else
jsonNull = new JSONNull(onNull);
jsonReturning = new JSONReturning(returning);
ctx.visit(N_JSON_OBJECT).sql('(').visit(QueryPartListView.wrap(QueryPartCollectionView.wrap(entries), jsonNull, jsonReturning).separator("")).sql(')');
}