Subject | Re: [firebird-support] NULL and equality |
---|---|
Author | Paul Vinkenoog |
Post date | 2004-05-28T23:44:29Z |
Hi all,
Alan wrote:
Now on the one hand, the SQL standard stresses that "state" and
"value" are such different concepts that we really, really mustn't use
the same equality operator for them (hence '=' for value comparison
and 'is' for state comparison)...
...but when we're talking assignment, all of a sudden it's no problem
to use the same operator to assign a value and a state. That's
inconsistent.
By the way, this has nothing to do with the fact that in SQL the
equality operator happens to be the same as the assignment operator.
Another inconsistency is found in statements like:
insert into Dogtable ( Name, IQ, Sound )
values ( 'Pluto', NULL, 'Woof' );
Er? NULL a *value* ?
But, as I said, we'll have to live with it...
Greetings,
Paul Vinkenoog
Alan wrote:
>> I always know that you can't compare NULL to anything but I mustMartijn:
>> say it's just a little ambiguous to have say
>> update table set field=NULL
>> instead of
>> update table set field to null
>> As infrequently as I use this statement, I find myself writing the
>> latter and having to correct myself to the former.
> Why? The "=" operator in an UPDATE statementThe difference being that first you assign a value, and then a state.
> doesn't mean "equals", it means "becomes".
>
> Hence, FIELD <becomes operator> 5 or
> FIELD <becomes operator> NULL
Now on the one hand, the SQL standard stresses that "state" and
"value" are such different concepts that we really, really mustn't use
the same equality operator for them (hence '=' for value comparison
and 'is' for state comparison)...
...but when we're talking assignment, all of a sudden it's no problem
to use the same operator to assign a value and a state. That's
inconsistent.
By the way, this has nothing to do with the fact that in SQL the
equality operator happens to be the same as the assignment operator.
Another inconsistency is found in statements like:
insert into Dogtable ( Name, IQ, Sound )
values ( 'Pluto', NULL, 'Woof' );
Er? NULL a *value* ?
But, as I said, we'll have to live with it...
Greetings,
Paul Vinkenoog