Ticket #1869 (closed defect: fixed)
Opened 7 years ago
Last modified 6 years ago
Exception when running report with no results on PySQLite2
| Reported by: | eblot | Owned by: | cmlenz |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.9 |
| Component: | report system | Version: | devel |
| Severity: | normal | Keywords: | |
| Cc: | |||
| Release Notes: | |||
| API Changes: | |||
Description
If an invalid SQL report is stored in the DB (whether it is invalid by syntax, or not able to be succesfully executed, for some SQL or Trac reason), there is no way to edit (fix up) or even delete this very report:
Trac only shows the Edit/Copy/Delete? Report buttons within the report result page, which is not displayed if the SQL request execution fails.
This is a Request for Enhancement, but I think it should also considered as a bug. Therefore, I don't know which severity to assign to this ticket. Feel free to update it.
Attachments
Change History
comment:1 Changed 7 years ago by cmlenz
- Milestone 0.9 deleted
- Severity changed from normal to enhancement
comment:2 Changed 7 years ago by eblot
I may have missed an important point, though.
For example, the following request fails to execute
SELECT p.value AS __color__, t.milestone AS __group__, id AS ticket, summary, component, status, resolution,version, severity, priority, owner, changetime AS modified, time AS _time,reporter AS _reporter FROM ticket t,enum p WHERE p.name=t.priority AND p.type='priority' AND t.status='closed' AND component='Camera' AND date(modified, 'unixepoch') BETWEEN '2005-07-01' AND '2005-07-31' ORDER BY (milestone IS NULL), milestone DESC
if there is no matching ticket. This ends up with an internal error. It may be two distinct issue:
- the request returns no data,
- Trac has an issue w/ such a case and triggers an internal exception
=> there is no way to delete the report
Or did I miss another way to delete (or edit) the report ?
comment:3 Changed 7 years ago by cmlenz
Can you provide the stack trace for the above error? I just get a normal "No matches found" message.
Try a simple query like:
SELECT * FROM foo;
This should of course fail, and I get the message "Report execution failed: no such table: foo" just below the buttons for editing or deleting the report.
comment:4 Changed 7 years ago by eblot
Here is the trace:
Python traceback (trunk [2033])
Traceback (most recent call last):
File "/local/engine/trac/trac/web/modpython_frontend.py", line 204, in handler
dispatch_request(mpr.path_info, mpr, env)
File "/local/engine/trac/trac/web/main.py", line 433, in dispatch_request
dispatcher.dispatch(req)
File "/local/engine/trac/trac/web/main.py", line 293, in dispatch
resp = chosen_handler.process_request(req)
File "/local/engine/trac/trac/ticket/report.py", line 127, in process_request
resp = self._render_view(req, db, id)
File "/local/engine/trac/trac/ticket/report.py", line 283, in _render_view
for col in cols:
TypeError: iteration over non-sequence
If I replace component with a component that has closed tickets in the same timeframe, everything runs fine.
comment:5 Changed 7 years ago by cmlenz
- Milestone set to 0.9
- Owner changed from daniel to cmlenz
- Priority changed from low to normal
- Severity changed from enhancement to normal
- Status changed from new to assigned
- Summary changed from Trac should permit edition/deletion of any SQL custom report to Exception when running report with no results on PySQLite2
Okay, I'm changing the scope of this ticket to that particular error. This only happens with PySQLite2 AFAICT, and I have a simple fix ready.
comment:6 Changed 7 years ago by cmlenz
- Resolution set to fixed
- Status changed from assigned to closed
This should be fixed in [2048].
comment:7 Changed 7 years ago by eblot
Ok, thanks.
Should I open a new request for enhancement to add edit/delete buttons on the report page ?
comment:8 Changed 7 years ago by cmlenz
Yeah, as an enhancement with no milestone (unless you provide a patch ;-) ).



This is a bit misleading, since Trac does allow editing/deleting reports that fail to execute. For example, just try a simple query for a non-existing table or column.
Internal errors in Trac however will prevent deletion/modification of reports. Such errors need to be fixed, obviously.
Nevertheless, I agree that it would be nice if reports could be edited/deleted directly from the report index page.