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

Implement a default OrderProvider in the code generator #9604

Closed
lukaseder opened this issue Nov 28, 2019 · 2 comments
Closed

Implement a default OrderProvider in the code generator #9604

lukaseder opened this issue Nov 28, 2019 · 2 comments

Comments

@lukaseder
Copy link
Member

The order of generated objects in code generation output is by default:

  • Alphabetic, where it doesn't matter. For example:
    • Sequences in a schema
    • Tables in a schema
  • In order of definition where it matters. For example:
    • Columns in a table
    • Parameters in a procedure

We guarantee this order by using SQL ORDER BY clauses in the jOOQ-meta implementations. This is often error prone as:

  • We sometimes forget to order content
  • We sometimes order content only partially
  • The order depends on something like a database collation, or a system flag, such as the MySQL lower_case_table_names

Instead, we could implement a default OrderProvider (a feature introduced in jOOQ 3.10: #4846) that works for all dialects alike, and stop ordering things in SQL.

Benefits:

  • All dialects behave the same way automatically
  • Edge cases can be fixed for all dialects
  • New dialects can be supported a bit more easily
  • The SQL statement might perform a bit better (the cost of ordering things is now in the client, of course)
  • Additional test coverage for the OrderProvider feature
@lukaseder lukaseder added this to the Version 3.13.0 milestone Nov 28, 2019
@lukaseder lukaseder added this to To do in 3.13 Other improvements via automation Nov 28, 2019
@lukaseder lukaseder removed this from To do in 3.13 Other improvements Dec 2, 2019
@lukaseder lukaseder added this to To do in 3.13 Other improvements via automation Dec 12, 2019
@lukaseder lukaseder self-assigned this Dec 12, 2019
@lukaseder lukaseder moved this from To do to In progress in 3.13 Other improvements Dec 16, 2019
@lukaseder
Copy link
Member Author

We probably still shouldn't remove ORDER BY clauses in Database implementations because custom order provider implementations might overlook some namespace relevant to ordering. If we produce ordered definitions to the user sort implementation, we could achieve a bit better sort stability in those cases.

@lukaseder
Copy link
Member Author

The default order provider should definitely be case insensitive given the default locale.

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

No branches or pull requests

1 participant