Modify ↓
Ticket #6610 (closed defect: worksforme)
Opened 4 years ago
Last modified 4 years ago
Bug creating new report with custom query
| Reported by: | msbrogli@… | Owned by: | mgood |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | report system | Version: | 0.10.3.1 |
| Severity: | normal | Keywords: | |
| Cc: | |||
| Release Notes: | |||
| API Changes: | |||
Description
I got an internal error when I create a new report using the following tag:
SELECT p.value AS __color__,
id AS ticket, summary, component, version, milestone, t.type AS type,
(CASE status WHEN 'assigned' THEN owner||' *' ELSE owner END) AS owner,
datetime(time, 'unixepoch') AS created,
changetime AS _changetime, description AS _description,
reporter AS _reporter
FROM ticket t
LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority'
WHERE status IN ('new', 'assigned', 'reopened')
ORDER BY p.value, milestone, t.type, time
the problem is with datetime command.. it's accepted by sqlite (i tried in sqlite console and worked fine).
Attachments
Change History
comment:1 Changed 4 years ago by eblot
- Severity changed from blocker to normal
comment:2 Changed 4 years ago by osimons
- Resolution set to worksforme
- Status changed from new to closed
Note: See
TracTickets for help on using
tickets.



Problem is that Trac does not understand the custom formatted dates it receives from the SELECT. That is also why you get an error messsage (that you could have included) that (at least for my 0.11b1) says something like:
For 0.10 it stores and uses unix timestamps, and for 0.11 it still stores timestamps but convert it to Python datetime objects on the fly for all internal use. The formatting is controlled by your Python / Server setttings and can only be changed there - not on input from the database.
For your report, you need to change time back to plain; time AS created.