Expand description
ILIKE to LIKE transformer
This transformer converts ILIKE (case-insensitive LIKE) operators to standard LIKE operators by wrapping both sides in UPPER() function calls.
§Problem
PostgreSQL-style ILIKE is convenient for case-insensitive pattern matching:
SELECT * FROM users WHERE email ILIKE '%@GMAIL.COM'But not all SQL engines support ILIKE natively.
§Solution
Transform ILIKE to UPPER(col) LIKE UPPER(pattern):
-- Input
WHERE email ILIKE '%@gmail.com'
-- Output
WHERE UPPER(email) LIKE UPPER('%@gmail.com')§Algorithm
- Traverse the entire AST
- Find all BinaryOp expressions with “ILIKE” operator
- Replace with LIKE operator and wrap both sides in UPPER()
- Recursively handle all clauses (WHERE, SELECT, HAVING, etc.)
Structs§
- ILike
ToLike Transformer - Transformer that converts ILIKE to UPPER() LIKE UPPER()