New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ClassCastException when nesting array(select row) projections in PostgreSQL #14105
Comments
The problem is this method in private static final Object[] pgNewArray(BindingScope ctx, Field<?> field, Class<?> type, String string) {
if (string == null)
return null;
DataType<?> t = field.getDataType();
try {
return Tools.map(
toPGArray(string),
// Problem here:
v -> pgFromString(ctx, field("array_element", type.getComponentType()), v),
size -> (Object[]) java.lang.reflect.Array.newInstance(type.getComponentType(), size)
);
}
catch (Exception e) {
// [#11823]
if (type.getComponentType().getSimpleName().equals("UnknownType"))
throw new DataTypeException("Error while creating array for UnknownType. Please provide an explicit Class<U> type to your converter, see https://github.com/jOOQ/jOOQ/issues/11823", e);
else
throw new DataTypeException("Error while creating array", e);
}
} We're creating a plain SQL type from the |
Perhaps the |
The regression isn't on #11829 directly, but when we wrap a |
Related: #13117 |
Fixed in jOOQ 3.18.0 and 3.17.5 (#14117) |
A spurious "flaky" test failure was observed when running tests in a certain order. This test runs fine in isolation:
But when the query is run twice, with flipped array projection columns, then the second execution fails with a
ClassCastException
. E.g. prepend this query to the above:And now, the following exception happens:
A likely cause for this behaviour could be that somehow the data type registers itself in the static type registry, and gets loaded from there on the second execution.
The text was updated successfully, but these errors were encountered: