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

Parser cannot parse undocumented reverse syntactic order of FOR UPDATE and LIMIT clauses from PostgreSQL #15826

Closed
lukaseder opened this issue Nov 13, 2023 · 2 comments

Comments

@lukaseder
Copy link
Member

This is valid in e.g. PostgreSQL:

select *
from t_book
order by id 
for update skip locked
limit 1

But jOOQ cannot handle it, producing:

Unsupported query type: [5:1] ...rom t_book
order by id 
for update skip locked
[*]limit 1

The correct syntax (even in PostgreSQL) should be:

select *
from t_book
order by id 
limit 1
for update skip locked

According to the docs:

Though, we've supported parsing alternative orders of SELECT clauses before, e.g. Oracle's arbitrary ordering of CONNECT BY, START WITH, GROUP BY, HAVING.

@lukaseder lukaseder added this to the Version 3.19.0 milestone Nov 13, 2023
@lukaseder lukaseder changed the title Parser cannot combine FOR UPDATE with LIMIT clauses Parser cannot parse reverse syntactic order of FOR UPDATE and LIMIT clauses Nov 13, 2023
@lukaseder
Copy link
Member Author

This also parses in PostgreSQL:

select *
from t_book
order by id
for update skip locked
offset 1 
limit 1

But this doesn't:

select *
from t_book
order by id
offset 1 
for update skip locked
limit 1

@lukaseder
Copy link
Member Author

Neither does this:

select *
from t_book
for update skip locked
order by id
offset 1 
limit 1

@lukaseder lukaseder changed the title Parser cannot parse reverse syntactic order of FOR UPDATE and LIMIT clauses Parser cannot parse undocumented reverse syntactic order of FOR UPDATE and LIMIT clauses from PostgreSQL Nov 13, 2023
@lukaseder lukaseder added this to To do in 3.19 Other improvements via automation Nov 13, 2023
lukaseder added a commit that referenced this issue Nov 13, 2023
…FOR UPDATE and LIMIT clauses from PostgreSQL
3.19 Other improvements automation moved this from To do to Done Nov 13, 2023
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