MySQL Forums
Forum List  »  Stored Procedures

Re: SELECT id, myFunc(id) FROM aTable ORDER BY id; returns bad data
Posted by: Mitch Stone
Date: September 27, 2005 02:46PM

Roland Bouman wrote:
> (and because he made it so easy to reproduce
> it all, i didnt need to change a single thing, so,
> good one Mitch!)

Thanks! I guess those 13 years of programming experience have come in handy for something.

> Then I was wondering if Mitch knew something
> about EXISTS that I did not know

Well, as much as I would like to claim some higher enlightenment, I have to admit that the IF EXISTS (SELECT COUNT(*)... was a fluke! I checked the documentation and just as we all expect, it quite specifically sez:

---------
13.2.8.6. EXISTS and NOT EXISTS
If a subquery returns any rows at all, then EXISTS subquery is TRUE, and NOT EXISTS subquery is FALSE.
...
Traditionally, an EXISTS subquery starts with SELECT *, but it could begin with SELECT 5 or SELECT column1 or anything at all. MySQL ignores the SELECT list in such a subquery, so it doesn't matter.
---------

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).

Thanks for the help!
-Mitch

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.