Subject RE: [firebird-support] Bug?
Author Svein Erling Tysvær
From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of Ivan Prenosil
Sent: 5. mai 2014 13:44
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] Bug?

>> this query return 0
>>
>> SELECT count(*) FROM RDB$DATABASE WHERE ((CAST(NULL AS INTEGER) IS
>> NULL AND CAST(123 AS INTEGER) IS NULL) OR (CAST(NULL AS INTEGER)=1))
>>
>> when i add "NOT" this query return also 0
>>
>> SELECT count(*) FROM RDB$DATABASE WHERE NOT ((CAST(NULL AS INTEGER) IS
>> NULL AND CAST(123 AS INTEGER) IS NULL) OR (CAST(NULL AS INTEGER)=1))
>>
>>
>> is this a bug?
>
>No. Where clause of the first select is
> True and False or Null -> Null
>So the second select is
> Not Null -> Null

Ivan is right (as always). One way to see that Firebird is correct, Karol, is to change your queries to use

... OR (CAST(NULL AS INTEGER) IS NOT DISTINCT FROM 1)

Then the second query will return 1.

Set