I'm trying to run this query using db.executesql(). I'm doing the string substitution (with the variable 'sid') before passing the query to executesql(), although I've also tried just passing the tuple (sid, sid) as the 'placeholders=' param to executesql, with the same results.
I can run this query (with 'sid' manually substituted) using psql and get a valid answer. But when running with executesql, it throws a QueryParameterParseError: '%:' not supported in quoted string. The issue seems to be with the % wildcard (..act like '%%:correct'). I can print out the string after the substitutions have happened, and the percent symbol seems to have been properly escaped - i.e. the double percent is replaced by a single percent symbol. '''select (select cast(count(*) as float) from useinfo where sid='%s' and event='mChoice' and act like '%%:correct' ) / (select cast(count(*) as float) from useinfo where sid='%s' and event=' mChoice' ) as result; ''' % (sid, sid) Is this a bug in PG8000? I did find this<https://groups.google.com/forum/#!topic/web2py/Gys8B5Y_hIQ> thread, but it seems to be more related to inserting a string containing the literal % rather than that using % as a wildcard. -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.