Subject Re: [firebird-support] Is there any logical difference?
Author Mark Rotteveel
On 2019-08-12 10:55, Svein Erling Tysvær setysvar@...
[firebird-support] wrote:
> I certainly agree with you that if EXISTS returns false, then NOT
> EXISTS should return true. It could make some sense if both EXISTS and
> NOT EXISTS returned <null> (though it should be documented somewhere),
> but not that one returns false and the other <null>. When you write
> this in the tracker, I think it would be good if you included a very
> simple reproducible test case.

EXISTS (nor NOT EXISTS) cannot and should not ever produce NULL. If it
does, then that is a bug.

SQL:2016 says:
1) Let T be the result of the <table subquery>.
2) If the cardinality of T is greater than 0 (zero), then the result of
the <exists predicate> is True; otherwise, the result of the <exists
predicate> is False.