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
SINGULAR buggy when nulls present [CORE1073] #1495
Comments
Commented by: @paulvink Several solutions are possible, but I'd like to suggest that SINGULAR's behaviour be modeled along the same lines as EXISTS: - TRUE if the search condition is met exactly once; IOW: SINGULAR( <query> ) <=> The result set of <query> contains exactly one row. |
Modified by: @dyemanovstatus: Open [ 1 ] => Resolved [ 5 ] resolution: Fixed [ 1 ] Fix Version: 2.1 [ 10041 ] assignee: Dmitry Yemanov [ dimitr ] |
Commented by: @pcisar Maybe I'm just tired today, but I can't figure out any reproducible test case for this issue. Can someone help me out? A simple SQL script would be great. |
Commented by: @paulvink Hi Pavel, the trick I used was to test on singular, not(singular), not singular and not(not singular). Otherwise you don't know if an empty set means false or null. So: set autoddl on; // first testcase: // second testcase: // likewise for 3rd and 4th testcases. // note that all this has already been fixed for 2.1; don't know about 2.0.1 and 1.5.4 |
Commented by: @pcisar Fix confirmed for 2.1 Alpha 1. Test added. |
Modified by: @pcisarstatus: Resolved [ 5 ] => Closed [ 6 ] |
Commented by: @pcisar Reopened to update ticket information. |
Modified by: @pcisarWorkflow: jira [ 11444 ] => Firebird [ 15480 ] |
Modified by: @pavel-zotovQA Status: No test |
Modified by: @pavel-zotovstatus: Closed [ 6 ] => Closed [ 6 ] QA Status: No test => Done successfully |
Submitted by: @paulvink
Is related to QA68
When the SINGULAR search condition evolves to NULL for certain records, the behaviour is inconsistent. Sometimes the result is plain wrong. Sometimes the result even depends on the natural ordering of records in the table.
Additionally, in versions up to 1.5.3, NOT SINGULAR may return a different result than NOT (SINGULAR). This is fixed in 2.0, although I didn't find an mention of it in the Release Notes.
Example cases:
(all use the same table, with a single nullable int field a.
the search is always "a=1")
1)
with table contents {2, null}, both SINGULAR and NOT SINGULAR return UNKNOWN.
2)
with {1, null}, SINGULAR returns True. NOT SINGULAR: False in 2.0, UNKNOWN in earlier versions.
This is inconsistent with case 1: if a null led to uncertainty there, it should do the same here.
3)
{1, null, 1} => both SINGULAR and NOT SINGULAR return UNKNOWN.
This is plain wrong: with two 1's, it ain't singular for sure.
4)
{1, 1, null} => SINGULAR: False. NOT SINGULAR: True.
This is correct, but note that this is the same set as the previous case, only with different insertion order!
Commits: 5320dae
The text was updated successfully, but these errors were encountered: