Andrew, It does only return one row, but, and here's the rub of it all, to limit the number of rows returned, zope tries to use the native rdbms facilities. Since MySQL has a LIMIT part to it's SELECT statement the sql that zope finally sends to MySQL looks like this: SELECT last_inserted_id() LIMIT 1000; Which is invalid as far as MySQL is concerned, *BUT* you actually want: SELECT last_inserted_id(); with no LIMIT statement. Zope does the limit bit regardless of how many rows would be returned, cos at the time it's building the sql statement it has no idea how many will be returned. It does what we tell it to. Setting the limit to 0 means that we want no limit, therefore zope doesn't put the LIMIT 1000 onto the end of the sql. daadaa :¬) Hope that helps Phil Andrew Altepeter wrote:
Woohoo! Thanks for the suggestion; it worked ;-)
You're now falling foul of the limit zope puts on the maximum numbers of rows returned from a zsql query by default.
I never would have thought that. Perhaps I'm not understanding this correctly, but doesn't select last_insert_id() only return one row? Then why do I need to unset the limit?
<big snip>