|previous : next|
This is experimental functionality, and as such subject to change. Use at your own risk!
This documentation is for the unreleased development version of jOOQ. Click on the above version links to get this documentation for a supported version of jOOQ.
Normalise associative operations
Applies to ✅ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
Associative operations are operations whose chaining can be done as
(a op b) op c or
a op (b op c) without changing the result. Examples of such operations are:
In order to simplify all of these pattern replacements, we normalise associative ops to always flatten tree structures into lists.
Using Settings.transformPatternsNormaliseAssociativeOps, the following transformations can be achieved:
-- With Settings.transformPatternsNormaliseAssociativeOps active, this: SELECT (a + b) + (c + d), (a * b) * (c * d), (a AND b) AND (c AND d), (a OR b) OR (c OR d) FROM tab; -- ... is transformed into the equivalent expression: SELECT ((a + b) + c) + d, -- (a + b) + (c + d) ((a + b) + c) + d, -- (a * b) * (c * d) ((a AND b) AND c) AND d, -- (a AND b) AND (c AND d) ((a OR b) OR c) OR d -- (a OR b) OR (c OR d) FROM tab;
Note that the unnecesary parentheses may not be generated in either case, but the in-memory data structure still looks as though the parentheses were there.