BSi;

Yes, you are correct.

I think you found an important behavior in MySQL. Whether it is a bug or a feature 
depends on what the developers choose 
to do. If they revise the manual, it must be a feature. ;-)

I think MySQL evaluates your original SELECT statements like a 'short-circuit OR': As 
soon as a TRUE result is found the 
evaluation stops.

I did a very poor test because I only worked with the small set of data you attached 
to your message. When I created two 
more rows with slightly different values, my proposed SELECT statement returned all 
rows instead of only the two that were 
wanted. 

My table now contains
+----------+
| nev |
+----------+
| Pokember |
| Pokxxber |
| pokember |
| pokxxber |
+----------+

All of the SELECT statements you tested before work exactly the same with this table 
as you described.
The SELECT statement I proposed, returns all of the rows.

I have found that using the string functions works better for this test. Apparently 
they do not short-circuit the same way.

The following two statements produce the same result as expected.
SELECT nev FROM hosoktest WHERE left(nev,4)='Poke' OR left(nev,4)='poke';
SELECT nev FROM hosoktest WHERE left(nev,8)='Pokember' OR left(nev,8)='pokember';
+----------+
| nev |
+----------+
| Pokember |
| pokember |
+----------+

SELECT nev FROM hosoktest WHERE left(nev,1)='P' OR left(nev,1)='p';
+----------+
| nev |
+----------+
| Pokember |
| Pokxxber |
| pokember |
| pokxxber |
+----------+

There were other SELECTs that I tried using this substring approach, but the behavior 
was predictable so I haven't included 
them here.

For the record, I am using mysql 3.23.43 on Mandrake-Linux 7.2

Regards,
Doug


On Fri, 28 Dec 2001 15:56:06 +0100, Barnabas BONA wrote:

>No, it works not. Maybe you thought the following:
>"SELECT nev FROM hosoktest WHERE nev IN ('pokember','Pokember');"
>It works but it's so strange...
>
>Ps: it's a feuture or a bug?
>
>Thanks,
>BSi
>
>Thursday, December 27, 2001, 7:52:37 AM, you wrote:
>> It works the way you want with this data when your query is written:
>
>> SELECT nev FROM hosoktest WHERE nev = ('pokember' OR 'Pokember');
>
>> Regards,
>> Doug
>
>
>
>> On Thu, 27 Dec 2001 01:33:57 +0100, Barnabas BONA wrote:
>
>>> If I execute the following select:
>>> SELECT nev FROM hosoktest WHERE nev = 'pokember' OR nev = \
>>> 'Pokember'
>>> I got only 'pokember' but 'Pokember' not...
>>>
>>> If I execute the following:
>>> SELECT nev FROM hosoktest WHERE nev = 'Pokember' OR nev = \
>>> 'pokember'
>>> I got only 'Pokember'.
>>>
>>> If I execute:
>>> SELECT nev FROM hosoktest WHERE nev = 'Pokember'
>>> I got correctly 'Pokember' only.
>>>
>>> If I execute:
>>> SELECT nev FROM hosoktest WHERE nev = 'pokember'
>>> I got correctly 'pokember' only.
>



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to