Skip to content

Trac+Postgre casting problem #16

nelsojost opened this Issue Feb 21, 2011 · 1 comment

2 participants


Running Trac with Postgre I got this error when set a value for Parent Tickets field in the "New Ticket" page:

Trac detected an internal error:

ProgrammingError: operator does not exist: text = integer
LINE 1: SELECT parent, child FROM subtickets WHERE parent=731
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.

Python traceback indicates problematic lines with cusor.execute() function in files and, like:

cursor.execute("SELECT parent, child FROM subtickets WHERE parent=%s",
                (parent_id, ))

The solution found is to force casting numeric fields like parent_id or ticket_id by doing:

cursor.execute("SELECT parent, child FROM subtickets WHERE parent=%s",
                (str(parent_id), ))

Don't know if this is the best approach, and I'm new in here, so I decide to report this problem and his "possible solution" as an issue.


If I understand correctly, in both and, all occurences of parent=%s and child=%s have to be single-quoted: parent='%s' and child='%s'. This seems to solve tickets #16 and #17.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.