New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DISTINCT vs NULLS LAST clause: wrong order of NULLs [CORE1005] #1416
Comments
Commented by: @pcisar According to my tests, this issue was not fixed in 2.0.1 create table T (A int, B int) ; insert into T values (1,1); select distinct A, B from T order by A, B nulls last ; A B select distinct A, B from T order by A nulls last ; A B select distinct A, B from T order by B nulls last ; A B |
Commented by: @dyemanov The NULLS clause belongs to a single ORDER BY element, so if you want to see nulls at the end, you should write: |
Commented by: @pcisar Fix verified, test added. |
Modified by: @pcisarstatus: Resolved [ 5 ] => Closed [ 6 ] |
Modified by: @pcisarWorkflow: jira [ 11321 ] => Firebird [ 15402 ] |
Modified by: @pavel-zotovQA Status: No test |
Modified by: @pavel-zotovQA Status: No test => Done successfully |
Submitted by: @dyemanov
Is related to QA22
By Daniel Bauten:
I found a bug concerning DISTINCT and NULLS LAST. E.g. in the statement:
select DISTINCT A, B
from T
order by A, B NULLS LAST
has no affect (and the NULLs are the first results).
In particular, NULLS LAST only takes effect if the "order
by" fields are not the "prefix" (in the meaning of an
ordered set) of the "select" fields.
Another example:
select DISTINCT A, B
from T
order by A NULLS LAST --> NULLS at beginning
select DISTINCT A, B
from T
order by B NULLS LAST --> NULLS at end ==> OK
An extra note by myself: the bug exists in FB 1.5 as well just shows itself a bit differently. For example, I see wrong nulls ordering for DISTINCT and NULLS FIRST.
Commits: 484bbf0 e95f814
The text was updated successfully, but these errors were encountered: