On 6/2/2011 9:57 PM, Roger Binns wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On 06/02/2011 12:31 PM, Jay A. Kreibich wrote: >> I suppose it would be technically correct to allow a LIMIT to 0, but >> that seems like a highly questionable approach. Any parameter value >> outside of 0 and 1 *is* non-sense and should be dutifully ignored >> and/or corrected-- or the whole statement should be considered >> invalid and an error thrown. >> >> While the phantom parameter issue might be worth addressing, in >> this specific case I think it is fair to call the query incorrect. > > The query used a binding to provide a limit of 1. If the binding is > discarded then SQLite has no idea of what value was going to be provided, > and hence had no idea if it was going to supply say 77 which is definitely > incorrect.
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. -- Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users