Null in greatest() function

Hi, doing some testing, I noticed that if one of the arguments of greatest() function is null, this is considered the greatest value.

We will look into it, it would be sensible to only provide a null if all entries are null.

PR to fix it here: fix(sql): breaking change 💥- `greatest(V)` and `least(V)` now return null only if all args are null by nwoolmer · Pull Request #5669 · questdb/questdb · GitHub

This aligns it properly with SqlServer.

1 Like

Thanks for this. I will get a lot of benefit from this

No problem!

Workaround for now is nesting CASE statements. It is ugly, but will work till next release.

1 Like

It has been merged, so should land in the next release. Let me know if you have any trouble with it!

1 Like