[JBoss JIRA] (TEIID-4802) Not in with subquery does not work correctly
by Steven Hawkins (JIRA)
[ https://issues.jboss.org/browse/TEIID-4802?page=com.atlassian.jira.plugin... ]
Steven Hawkins resolved TEIID-4802.
-----------------------------------
Resolution: Rejected
> Could the null value be causing this?
Yes, that is exactly the issue.
"x NOT IN (values)" is the same as "NOT (x IN (values))", which is the same as "NOT (x = v1 OR x = v2 OR ...)". "x = null" evaluates to UNKNOWN, then UNKNOWN OR false evaluates to UNKNOWN, which leave you eventually with NOT(UNKNOWN), which is again just UNKNOWN. So the tuple will not pass the predicate.
> Not in with subquery does not work correctly
> --------------------------------------------
>
> Key: TEIID-4802
> URL: https://issues.jboss.org/browse/TEIID-4802
> Project: Teiid
> Issue Type: Bug
> Affects Versions: 9.0.5, 9.1.4
> Reporter: Bram Gadeyne
> Assignee: Steven Hawkins
> Priority: Critical
> Attachments: query_plan_not_in.txt
>
>
> Hi,
> This query does not return any results where it should.
> {code:sql}
> select cl.*
> from izalert_clientstatus cl
> where cl.hostname not in (
> select WSidentifier from prod_U_PV_PClist
> )
> {code}
> This query is more or less equivalent to the one above but does return 28 results.
> {code:sql}
> select cl.hostname
> from izalert_clientstatus cl
> left join prod_U_PV_PClist pl on cl.hostname = pl.WSidentifier
> where pl.WSidentifier is null
> {code}
> hostname and wsidentifier are both String fields. In the clientstatus table it has a length of 255, in the other table 63. The values for hostname and wsidentifier are e.g. 'COSARA4' and 'PC-10360'
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
7 years, 10 months