Skip to content
This repository

Trac+Postgre casting problem #16

Open
nelsojost opened this Issue February 21, 2011 · 1 comment

2 participants

nelsojost MartinBorg
nelsojost

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 web_ui.py and api.py, 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.

MartinBorg

If I understand correctly, in both api.py and web_ui.py, 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.