Skip to content
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

DSL.unnest(Collection) doesn't work on PostgreSQL #8933

Closed
lukaseder opened this issue Jul 11, 2019 · 0 comments
Closed

DSL.unnest(Collection) doesn't work on PostgreSQL #8933

lukaseder opened this issue Jul 11, 2019 · 0 comments

Comments

@lukaseder
Copy link
Member

This query doesn't work on PostgreSQL, when inlining bind variables:

Integer[] values = { 1, 2, 3 };

Result<Record2<String, Integer>> r3 = create
    .select(
        val("a"),
        columnValue)
    .from(unnest(asList(values)).as("x"))
    .fetch();

This is because the Integer[] array component type information is lost when passing a List<Integer> to unnest(), so jOOQ generates

cast('{"1","2","3"}' as any[])

I cannot think of a thorough fix. PostgreSQL arrays need an array type, and any[] is not supported in SQL (it is in pgplsql, I think). So a reasonable thing to do might be to pick the array type from the first element, hoping there is such a first element.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant