You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
COALESCE: returns int|null even if one argument is not nullable #460
I am not quite sure if or how this is fixable but if COALESCE is called with multiple arguments and one of them is not nullable then the value should also not be nullable.
Example:
Table:
CREATE TABLE ak (
akid int NOT NULL DEFAULT 0,
eladaid int DEFAULT NULL,
eadavk decimal(12,2) NOT NULL
);
Query:
SELECT COALESCE(eladaid, akid) as id FROM ak
I would expect that the value for id is always int
Apologies for not getting back to you earlier. I just tried this in our code base. Unfortunately, we are using PostgreSQL and it looks like sqlftw/sqlftw only supports MySQL so far. This currently fails with several internal errors like Internal error: Unable to resolve column TIME in file in ParserInference::narrowResultType line 91.
Activity
staabm commentedon Nov 11, 2022
This requires an sql-AST which we don't yet have .. but who knows ;-)
staabm commentedon Feb 16, 2023
@glaubinix please try the latest release. SQL Ast type narrowing is a opt-in feature right now, enabled via
RuntimeConfiguration.See release notes
Please give it a try
glaubinix commentedon Feb 17, 2023
Thanks, will give this a try next week!
glaubinix commentedon Feb 23, 2023
Apologies for not getting back to you earlier. I just tried this in our code base. Unfortunately, we are using PostgreSQL and it looks like
sqlftw/sqlftwonly supports MySQL so far. This currently fails with several internal errors likeInternal error: Unable to resolve column TIME in fileinParserInference::narrowResultTypeline 91.staabm commentedon Feb 23, 2023
thanks for the feedback. I added a new todo item for supporting AST in postgres.
for now we will explore the AST features in mysql only, until
sqlftw/sqlftwstabilizes and natively supports postgres.