Edgewall Software

Ticket #1869 (closed defect: fixed)

Opened 4 years ago

Last modified 3 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:

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

Changed 4 years ago by cmlenz

  • severity changed from normal to enhancement
  • milestone 0.9 deleted

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.

Changed 4 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:

  1. the request returns no data,
  2. 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 ?

Changed 4 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.

Changed 4 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.

Changed 4 years ago by cmlenz

  • status changed from new to assigned
  • severity changed from enhancement to normal
  • summary changed from Trac should permit edition/deletion of any SQL custom report to Exception when running report with no results on PySQLite2
  • priority changed from low to normal
  • milestone set to 0.9
  • owner changed from daniel to cmlenz

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.

Changed 4 years ago by cmlenz

  • status changed from assigned to closed
  • resolution set to fixed

This should be fixed in [2048].

Changed 4 years ago by eblot

Ok, thanks.

Should I open a new request for enhancement to add edit/delete buttons on the report page ?

Changed 4 years ago by cmlenz

Yeah, as an enhancement with no milestone (unless you provide a patch ;-) ).

Add/Change #1869 (Exception when running report with no results on PySQLite2)

Author


E-mail address and user name can be saved in the Preferences.


Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from cmlenz. Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.