Skip to content

Is there a way to fail if I create an update statement without set? #15743

Closed Answered by lukaseder
robstoll asked this question in Q&A
Discussion options

You must be logged in to vote

does not throw as I would expect in SQL when leaving out SET ..

SQL doesn't support an empty SET clause, but jOOQ does. The question is: What does it mean for an empty set clause to be passed? It could mean two things:

  1. All rows matching the WHERE clause should be locked, but nothing should be changed
  2. Nothing happens (this is what jOOQ opted for)

I would assume that if SQL supported the syntax, then 1) would be the correct approach, similar to running a SELECT .. FOR UPDATE, though the UPDATE would actually fire triggers.

You cannot change this behaviour, but you can intercept such statements by implementing an ExecuteListener and checking executeContext.query() instanceof QOM.Update u…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@robstoll
Comment options

Answer selected by lukaseder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment