MySQL Forums
Forum List  »  Stored Procedures

Re: SELECT id, myFunc(id) FROM aTable ORDER BY id; returns bad data
Posted by: Roland Bouman
Date: September 27, 2005 03:34PM

Mitch Stone wrote:
> Seems I've found two bugs in one! Altho,
> personally, I'm less inclined to consider the
> EXISTS behavior as a bug, since it does seem to be
> functioning correctly (and I don't have to change
> all my other functions that use the same
> convention).

Well, as far as I can see, the test you are using now would always
1) return at least one row
2) let the count(*) evaluate to 1
so i don't think you can conclude that EXISTS is buggy (you are feeding id's from the table, right?) or do you have another set of data wich does prove EXISTS is behaving badly?

The confusing result from my test all seems to boil down to DUAL, not EXISTS.

I was in the middle of a reply to Jay's post (thanks for the compliment! but i always copy snappy definitions from textbooks, like the one you wrote ;-) yesterday but it seems I never posted it. Anyway, in that post I wanted to let you all know that I reported the DUAL business as a bug (see http://bugs.mysql.com/bug.php?id=13496 for details). Cut short, try these, and tell me what you think....

SELECT COUNT(*) col FROM dual WHERE 1=0
;
-- (returns an empty set, but should return one row with the value 0)

SELECT COUNT(*) col FROM dual WHERE 1=1
;
-- (returns one row, with the value 0 for col)


Mitch, are you going to report your bug? If so, could you post the id? I'd like to subscribe.

Thanks in advance

Roland.



Edited 1 time(s). Last edit at 09/27/2005 03:37PM by Roland Bouman.

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.