Make sure empty cond collapser works on all positions

Adds another round of sql stabilization (akin to 5268b1da6)
Fix condition collapser corrupting -X operators

This is (fingercross) the complete fix for RT#98161