Subject Re: RES: RES: [firebird-support] Null and parameters
Author Christian Danner
Hi Svein,

on Mon, 09 Jan 2006 09:22:21 -0000, you wrote:

>--- In, Christian Danner wrote:
>> But why not generally permit the expression 'null is null' as a
>> comparison, when '1 is null' (e.g. in a 'select case' statement) is
>> allowed and interpreted as 'false'. Shouldn't 'Unknown is Unknown'
>> be a legitimate question and answered with 'true'?
>If 'Unknown' was a value rather than a state, I would agree. But I
>consider this
>[<variable> | <constant>] is null
>and if someone asked me:
>"Tell me if the answer to my unknown question is unknown to you", then
>I would answer "I don't know". If the question was: "Tell me if the
>square root of -1 is unknown to you", I would answer yes, but if it
>was "Tell me if the square root of 4 is unknown to you", I would
>answer no. So to me it isn't that obvious that NULL IS NULL should
>return true...

I think your Q&A examples don't point to the heart of the matter. This
isn't a quiz with the validity of the right hand result depending on
the left hand question. It's a comparison between two independent, not
interacting items.

As 'null' is the state of a variable, not it's value, with 'is' you
compare states and only states, not values (for the latter 'extended'
comparison of values with state 'known' you have =,<,>,<>). If then
two variables have the same state ('un-/known'), why not answer 'yes'
and return 'true' to the question 'Do they have the same state?':

null is null: true
1 is null: false
null is 1: false
1 is 1: true
and even
1 is 2: true (strange but consistent)

Irrespective of SQL standards I take the view that the usage of 'is'
actually is cut down unnecessarily.