[Jython] [pg8000] Prepare two phase transaction fails

Issue #1386 resolved
Former user created an issue

On postgres+zxjdbc, do_prepare_twophase fails on:

    connection.execute(sql.text("PREPARE TRANSACTION :tid", bindparams=[xid)](sql.bindparam('tid',)))

The zxJDBC driver uses the qmark format type, so the bind parameterization ends up translating this query to:

PREPARE TRANSACTION ?

But postgres only seems to support a constant string here. pg8000 users also noticed this issue:

https://bugs.launchpad.net/pg8000/+bug/230794

Is replacing this with connection.execute("PREPARE TRANSACTION '%s'" % xid) safe enough, or do we need something else?

Comments (6)

  1. Mike Bayer repo owner

    if PG in general requires a constant string, and psycopg2 was just letting us get away with it, then yes we should change that to just be an inline string (and we can lose the text() construct too while we're at it).

  2. Log in to comment