noisepage
noisepage copied to clipboard
WHERE clause literals don't work
WHERE
clauses with literals are broken for a few reasons:
SELECT * FROM foo WHERE true
(or false
) explodes in codegen because these literals end up as a TypeCastExpression
with a child ConstantValueExpression
. There seems to be a recurring debate over where type casting and promotion should happen, and for now that means this breaks since no one handles it correctly. Other expressions that resolve to boolean (i.e. 5=5
) work just fine.
SELECT FROM foo WHERE null
explodes because NULL
doesn't have a defined type on its own (they stay type::TypeId::INVALID
). Maybe the binder can just change this to a boolean false
since it would have the same effect? Not sure about that fix since it feels like a special-case hack. As above, and equally amusing, other expressions that resolve to null (i.e. 1=NULL
) work just fine.
#1545 at least fixes the case for literals of invalid types.