Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trac+Postgre casting problem #16

Open
nelsojost opened this issue Feb 21, 2011 · 1 comment
Open

Trac+Postgre casting problem #16

nelsojost opened this issue Feb 21, 2011 · 1 comment

Comments

@nelsojost
Copy link

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.

@ghost
Copy link

ghost commented Jan 11, 2012

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.

rdnvndr pushed a commit to rdnvndr/trac-subtickets-plugin that referenced this issue Jan 11, 2017
Added more configuration options and made administration possible through the admin panel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant