Re: FW: [SQL] = operator vs. IS

2004-06-29 Thread Rich Hall
My question is why is the form (anything) = NULL allowed? Since (anything) = NULL is always Null, this cannot be what the coder intended. This is much different when comparing two variables, where the coder may have to handle the cases where the variables are Null. Here the comparison is to a

Re: FW: [SQL] = operator vs. IS

2004-06-29 Thread Tom Lane
Rich Hall [EMAIL PROTECTED] writes: My question is why is the form (anything) = NULL allowed? If you think it shouldn't be, you can turn on the transform_null_equals flag. However, past experience has shown that that breaks more things than it fixes. In any case, few people like to depend on

Re: FW: [SQL] = operator vs. IS

2004-06-29 Thread Michael Kleiser
NULL is handled like unknow When you comparing something with an unknown value, you are not able to say if they are equal or not. So the result is also unknown. The result NULL is correct. If you whant to check if somethings is NULL you have to use (anything) IS NULL Rich Hall schrieb: My

Re: FW: [SQL] = operator vs. IS

2004-06-29 Thread Peter Eisentraut
Rich Hall wrote: My question is why is the form (anything) = NULL allowed? Since (anything) = NULL is always Null, this cannot be what the coder intended. Using that same line of argument, why is 1+1 allowed? The coder clearly knows that it is 2, so why is he writing that? Many

Re: FW: [SQL] = operator vs. IS

2004-06-29 Thread Stephan Szabo
On Tue, 29 Jun 2004, Greg Stark wrote: Stephan Szabo [EMAIL PROTECTED] writes: IS TRUE and IS FALSE have a different effect from =true and =false when the left hand side is NULL. The former will return false, the latter will return NULL. No, actually they both return false. For

Re: FW: [SQL] = operator vs. IS

2004-06-29 Thread Greg Stark
Rich Hall [EMAIL PROTECTED] writes: (anything) = NULL is always Null, this cannot be what the coder intended. I often have such things in my SQL. Consider what happens when you have SQL constructed dynamically. Or more frequently, consider that many drivers still don't use the new binary

Re: FW: [SQL] = operator vs. IS

2004-06-29 Thread Greg Stark
Stephan Szabo [EMAIL PROTECTED] writes: IS TRUE and IS FALSE have a different effect from =true and =false when the left hand side is NULL. The former will return false, the latter will return NULL. No, actually they both return false. (But thanks, I didn't even realize they were special

[SQL] = operator vs. IS

2004-06-28 Thread Stefan Weiss
Hi. I'm just curious - why is it not possible to use the = operator to compare values with NULL? I suspect that the SQL standard specified it that way, but I can't see any ambiguity in an expression like AND foo.bar = NULL. Is it because NULL does not equal any value, and the expression should be

FW: [SQL] = operator vs. IS

2004-06-28 Thread Dmitri Bichko
your question. Dmitri -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Stefan Weiss Sent: Monday, June 28, 2004 6:02 PM To: [EMAIL PROTECTED] Subject: [SQL] = operator vs. IS Hi. I'm just curious - why is it not possible to use the = operator to compare

Re: [SQL] = operator vs. IS

2004-06-28 Thread Michael A Nachbaur
On June 28, 2004 03:02 pm, Stefan Weiss wrote: I'm just curious - why is it not possible to use the = operator to compare values with NULL? I suspect that the SQL standard specified it that way, but I can't see any ambiguity in an expression like AND foo.bar = NULL. Is it because NULL does not

Re: [SQL] = operator vs. IS

2004-06-28 Thread Steve Crawford
I'm just curious - why is it not possible to use the = operator to compare values with NULL? I suspect that the SQL standard specified it that way, but I can't see any ambiguity in an expression like AND foo.bar = NULL. Is it because NULL does not equal any value, and the expression should be

Re: [SQL] = operator vs. IS

2004-06-28 Thread terry
:[EMAIL PROTECTED] Behalf Of Michael A Nachbaur Sent: Monday, June 28, 2004 6:28 PM To: Stefan Weiss Cc: [EMAIL PROTECTED] Subject: Re: [SQL] = operator vs. IS On June 28, 2004 03:02 pm, Stefan Weiss wrote: I'm just curious - why is it not possible to use the = operator to compare values

Re: FW: [SQL] = operator vs. IS

2004-06-28 Thread Stefan Weiss
Re, thanks for all the replies. On Tuesday, 29 June 2004 00:17, Dmitri Bichko wrote: As far as TRUE and FALSE go, from what I know you can use = to compare them with boolean columns, unless I misunderstood your question. Sorry, I must have remembered that incorrectly, or maybe I've been

Re: FW: [SQL] = operator vs. IS

2004-06-28 Thread Stephan Szabo
On Tue, 29 Jun 2004, Stefan Weiss wrote: On Tuesday, 29 June 2004 00:17, Dmitri Bichko wrote: As far as TRUE and FALSE go, from what I know you can use = to compare them with boolean columns, unless I misunderstood your question. Sorry, I must have remembered that incorrectly, or maybe