-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 06/02/2011 07:09 PM, Igor Tandetnik wrote: > For a subselect like the one in question, SQLite picks the value from > the first row - whichever row this happens to be - and ignores the rest. > Providing an explicit LIMIT 1, or for that matter LIMIT 77, doesn't > change anything. In particular, it doesn't make the ordering, and the > choice of which row will be the first, any more deterministic. So you > may just as well drop the LIMIT clause.
We are whacking in the weeds here, and actually substantially agree :-) My point was that if a LIMIT of 1 is supplied then it can be reasonably certain that the subquery usage was intentional whereas if a LIMIT of 77 is supplied then it is extremely likely that the subquery is erroneous. SQLite *currently* just takes whatever the first row is (as documented), but could in the future have a "lint" or similar mode where it explicitly rejects or warns about what appear to be erroneous queries. If SQLite ever does that then this query was correct in the sense that there is no reason to reject or warn about it, whereas a LIMIT of 77 would be. Roger -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEARECAAYFAk3oRysACgkQmOOfHg372QTXIACgy28yfrdTgQOrnFQzq7VV1Aoj bu4AoL8z8F0NQuwQe3qPXDhe/6DNgqWb =fdd3 -----END PGP SIGNATURE----- _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

