This simple query doesn't work:
SELECT lower(a) = lower(b)
FROM (VALUES ('A', 'a')) t (a, b)
The error is:
SQL Error [42581]: unexpected token: =
A workaround is to wrap the left expression in parentheses:
SELECT (lower(a)) = lower(b)
FROM (VALUES ('A', 'a')) t (a, b)
The problem doesn't seem to appear in contexts that explicitly expect predicates, e.g. this works:
SELECT 1
FROM (VALUES ('A', 'a')) t (a, b)
WHERE lower(a) = lower(b);
But these also don't work:
SELECT 1
FROM (VALUES ('A', 'a')) t (a, b)
GROUP BY lower(a) = lower(b);
SELECT 1
FROM (VALUES ('A', 'a')) t (a, b)
WHERE COALESCE(lower(a) = lower(b), TRUE);
Thanks Lukas. Will fix next year.