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

ORDER BY <field index> should resolve nested record emulation #11904

Closed
lukaseder opened this issue May 20, 2021 · 1 comment
Closed

ORDER BY <field index> should resolve nested record emulation #11904

lukaseder opened this issue May 20, 2021 · 1 comment

Comments

@lukaseder
Copy link
Member

When using ORDER BY 2, 1, users are referencing fields by index. If such a field is a nested record (#11812), or an embeddable record (#10527), then we must replace the index by an expanded row field, if the dialect has no native support. I.e.:

-- With native support, e.g. PostgreSQL:
SELECT a, row(b, c), d
FROM t
ORDER BY 2, 1, 3

-- Without native support
SELECT a, b as "row.b", c as "row.c", d
FROM t
ORDER BY 2, 3, 1, 4

In other words:

  • We should continue using field indexes, not expressions, etc. i.e. 2 -> 2, 3
  • We must expand individual indexes by their index list
  • We must shift indexes after a row reference, i.e. 3 -> 4
@lukaseder
Copy link
Member Author

Fixed for jOOQ 3.15.0. The fix is very laborious and depends heavily on Java 8 usage, so I won't backport it.

lukaseder added a commit that referenced this issue May 20, 2021
lukaseder added a commit that referenced this issue May 20, 2021
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