Hi, I think I've narrowed down the problem - web2py doesn't escape backslashes in its SQL strings. Everything I found on the web said that backslashes had to be escaped for SQL (though I couldn't confirm this with an official document).
My solution is to add escaping of backslashes to the last line of sql_represent in gluon/sql.py Regards, David