id,summary,reporter,owner,description,type,status,priority,component,severity,resolution,keywords,cc,release 11981,"ProgrammingError: (1064, ""You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '== 'status' \n ORDER BY tc.time' at line 4"")",zj@…,Guillermo M Narvaja,"I read the file showed in Python Traceback and find a SQL syntax error in python code: = build/bdist#linux-x86_64/egg/ticketstats/ticketstats#py"", line 236 tc.field == 'status' should be tc.field = 'status' according to SQL syntax. {{{ 231 # Count closed and reopened tickets 232 cursor.execute("""""" 233 SELECT newvalue 234 FROM ticket_change tc 235 INNER JOIN ticket t ON t.id = tc.ticket AND tc.time > 0 236 AND tc.time <= %%s AND tc.field == 'status' %s 237 ORDER BY tc.time"""""" % milestone_str, args) }}} ==== How to Reproduce ==== While doing a GET operation on `/ticketstats`, Trac issued an internal error. ''(please provide additional details here)'' Request parameters: {{{ {} }}} User agent: `Mozilla/5#0 #Windows NT 6#1; WOW64; Trident/7#0; SLCC2; #NET CLR 2#0#50727; #NET CLR 3#5#30729; #NET CLR 3#0#30729; Media Center PC 6#0; #NET4#0C; #NET4#0E; InfoPath#3; QQBrowser/8#0#1287#400; rv:11#0# like Gecko` ==== System Information ==== || '''`Trac`''' || `1#0#1` || || '''`Genshi`''' || `0#7 #without speedups#` || || '''`mod_python`''' || `3#3#1` || || '''`MySQL`''' || `server: ""5#0#22"", client: ""5#5#13"", thread-safe: 1` || || '''`MySQLdb`''' || `1#2#3` || || '''`Python`''' || `2#7#5 #default, Jun 26 2013, 03:04:02# ` ##br## `#GCC 4#1#2 20080704 #Red Hat 4#1#2-52##` || || '''`pytz`''' || `2013b` || || '''`setuptools`''' || `0#7#3` || || '''`jQuery`''' || `1#7#2` || ==== Enabled Plugins ==== || '''`cc-selector`''' || `0#0#2` || || '''`IniAdmin`''' || `0#3` || || '''`NavAdd`''' || `0#1` || || '''`TracAccountManager`''' || `0#4#3` || || '''`TracDateField`''' || `1#1#0-r12118` || || '''`TracMasterTickets`''' || `2#1#3` || || '''`TracProgressMeterMacro`''' || `0#4-r11720` || || '''`TracSubTicketsPlugin`''' || `0#2#0#dev-20130704` || || '''`TracTab`''' || `0#2#0dev` || || '''`TracTicketChangelogPlugin`''' || `0#1` || || '''`TracTicketCharts`''' || `0#2dev` || || '''`Tracticketstats`''' || `3#0#0dev` || || '''`TracTocMacro`''' || `11#0#0#3` || || '''`TracWysiwyg`''' || `0#12#0#5` || ==== Python Traceback ==== {{{ Traceback #most recent call last#: File ""/usr/local/lib/python2#7/site-packages/trac/web/main#py"", line 497, in _dispatch_request dispatcher#dispatch#req# File ""/usr/local/lib/python2#7/site-packages/trac/web/main#py"", line 214, in dispatch resp = chosen_handler#process_request#req# File ""build/bdist#linux-x86_64/egg/ticketstats/ticketstats#py"", line 119, in process_request last_num_open = get_num_open_tix#db, last_date, milestone# File ""build/bdist#linux-x86_64/egg/ticketstats/ticketstats#py"", line 237, in get_num_open_tix ORDER BY tc#time"""""" % milestone_str, args# File ""/usr/local/lib/python2#7/site-packages/trac/db/util#py"", line 65, in execute return self#cursor#execute#sql_escape_percent#sql#, args# File ""build/bdist#linux-x86_64/egg/MySQLdb/cursors#py"", line 174, in execute self#errorhandler#self, exc, value# File ""build/bdist#linux-x86_64/egg/MySQLdb/connections#py"", line 36, in defaulterrorhandler raise errorclass, errorvalue ProgrammingError: #1064, ""You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '== 'status' \n ORDER BY tc.time' at line 4""# }}}",defect,closed,normal,TicketStatsMacro,normal,worksforme,,,