mini\Database\AstOptimizer::rewriteNegations()
Method
private
Signature
private function rewriteNegations(mini\Parsing\SQL\AST\ASTNode $node): mini\Parsing\SQL\AST\ASTNode
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$node |
mini\Parsing\SQL\AST\ASTNode |
required | Documentation missing |
Returns
Documentation
Rewrite negated predicates using De Morgan's laws
SQL has three-valued logic: True, False, Unknown (NULL). NOT only inverts True ↔ False; Unknown stays Unknown.
Using set complement (except) incorrectly includes NULL rows. De Morgan transformations give correct NULL semantics:
NOT BETWEEN low AND high → col < low OR col > high NOT (a > b) → a <= b NOT (a AND b) → NOT a OR NOT b NOT (a OR b) → NOT a AND NOT b NOT NOT a → a