Cannot currently be done but it’s an interesting idea.
I wrote some experimental code that yields the following formatted result:
BEGIN
SELECT x
INTO z
FROM y
WHERE a = b
AND cccccccc = d
AND e = fffffffffff
AND ggg = hhh
OR a = b
AND ccccccccccccccccccccccccccc = d
AND e = fffffffffff
AND ggg = hhh
OR uuuuuuuuuuuuuuuuuuuuuu = v
OR w = t;
a := 1;
bbbbbbbbbbbb := 2;
c := 333333333333;
END;
This is just experimental, options need to be added and there’s more to it, but the idea works.
I’ve queued it as an enhancement request (QP-1012).
Here’s where the fun comes in. Expressions come in many flavors. We could do something like this:
WHERE a = b
AND cccccccc = d
AND e <> fffffffffff
AND z NOT IN (u, v, w)
AND k BETWEEN lll AND mmm
AND r BETWEEN ssssssssssssssssssssssssssssssssssssssssssssssss
AND tttttttttttttttttttttttttttttt
if line wrap occurs in a list of items, try to align the items (left-aligned for char literals, decimal-aligned for numerics)
I am aware that you will have to strike a balance with regard to the number of formatting options to support in the sense that an extensive set of supported options will require more code with a higher level of complexity, with the associated price tag of more defects and more time required for support. I’m merely sketching my ideal, and will leave it up to you to decide what is doable and supportable.
if line wrap occurs in a list of items, try to align the items (left-aligned for char literals, decimal-aligned for numerics)
I am aware that you will have to strike a balance with regard to the number of formatting options to support in the sense that an extensive set of supported options will require more code with a higher level of complexity, with the associated price tag of more defects and more time required for support. I'm merely sketching my ideal, and will leave it up to you to decide what is doable and supportable.