The default null ordering strategy is differs depending on wether a GROUP BY clause is present or not:
select languages l from test_emp where salary > 73000 order by l
l
---------------
1
2
3
4
null
null
select languages l from test_emp where salary > 73000 group by l order by l
l
---------------
null
1
2
3
4
For DESC order, the same issue occurs but in reversed direction.
The desired behavior would probably be to have consistent null ordering for ASC and DESC respectively. The SQL standard does not prescribe a default null ordering if NULLS FIRST/LAST is not specified and various databases implement it differently. E.g. H2 treats null as the smallest value and Postgres treats it as the largest value if not specified otherwise.
This issue is related to #34550 which asks for the support of explicit null ordering with NULLS FIRST/LAST.
The default null ordering strategy is differs depending on wether a
GROUP BYclause is present or not:For
DESCorder, the same issue occurs but in reversed direction.The desired behavior would probably be to have consistent null ordering for
ASCandDESCrespectively. The SQL standard does not prescribe a default null ordering ifNULLS FIRST/LASTis not specified and various databases implement it differently. E.g. H2 treats null as the smallest value and Postgres treats it as the largest value if not specified otherwise.This issue is related to #34550 which asks for the support of explicit null ordering with
NULLS FIRST/LAST.