Behavior of .execute() wo parameters does not match psycopg2 #136

Closed
jlubken opened this Issue Mar 7, 2016 · 1 comment

Projects

None yet

2 participants

@jlubken
jlubken commented Mar 7, 2016

psycopg2 does not attempt to resolve parameters if none are passed:

sql = '''select cast('100%' as varchar) as expected'''
psycopg2_cursor.execute(sql)

I believe this is done so that the output of .mogrify() may be passed to .execute() without a second attempt to resolve parameters where '%' may be in the data.

momoko attempts to resolve parameters even if none are passed:
momoko_cursor = (yield db.execute(sql)) # fails
momoko_cursor = (yield db.execute(sql.replace('%', '%%')) # passes

@haizaar haizaar closed this in #137 Mar 10, 2016
@haizaar
Collaborator
haizaar commented Mar 10, 2016

Thanks for the bug report. You are welcome to try master branch. I'll release 2.2.3 later this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment