Opened 18 years ago
Closed 17 years ago
#5543 closed defect (fixed)
Default reports ({6}, {7}, {11} maybe others) are not working for all backends
Reported by: | Owned by: | Christian Boos | |
---|---|---|---|
Priority: | high | Milestone: | 0.11 |
Component: | report system | Version: | devel |
Severity: | major | Keywords: | postgresql |
Cc: | trac-ja@… | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
at least under postgresql… there's a syntax error in the last line:
(CASE status WHEN 'closed' THEN modified ELSE (-1)*p.value END) DESC
psql flags "modified" as a syntax error.
Attachments (0)
Change History (9)
comment:1 by , 17 years ago
Component: | general → report system |
---|---|
Owner: | changed from | to
Severity: | normal → critical |
comment:2 by , 17 years ago
Keywords: | sql added |
---|---|
Milestone: | → 0.11.1 |
Severity: | critical → major |
Summary: | Query {6} is broken → Default reports ({6}, {7}, {11} maybe others) are not working for all backends |
comment:4 by , 17 years ago
comment:5 by , 17 years ago
Keywords: | postgresql added; sql removed |
---|---|
Priority: | normal → high |
Another duplicate, #6846.
comment:6 by , 17 years ago
Cc: | added |
---|
comment:7 by , 17 years ago
I encount this bug at {6} with native stacktrace. ({7} runs normally.)
There are two problems:
- SQL compatibility
- When catch Exception from DB, Must show
TracError
page
This patch fixes problem 1 againsts source:trunk@6653.
It is tested on SQLite-3.4.3 (on Ubuntu-7.10) and PostgreSQL-8.2.6(on Ubuntu-7.10), however it is not tested on MySQL.
-
trac/db_default.py
280 280 FROM ticket t 281 281 LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority' 282 282 ORDER BY (milestone IS NULL), milestone DESC, (status = 'closed'), 283 (CASE status WHEN 'closed' THEN modified ELSE (-1)*p.valueEND) DESC284 """ ),283 (CASE status WHEN 'closed' THEN changetime ELSE (-1) * %s END) DESC 284 """ % db.cast('p.value', 'int')), 285 285 #---------------------------------------------------------------------------- 286 286 ('My Tickets', 287 287 """
comment:8 by , 17 years ago
Milestone: | 0.11.1 → 0.11 |
---|---|
Owner: | changed from | to
Status: | new → assigned |
Thanks for the patch! I'll (reluctantly) check for MySQL.
I think it's worth getting applied for 0.11, as we can anticipate a lot of fresh installs when 0.11 ships and … a lot of new duplicates of this ticket if it is not fixed before.
comment:9 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Verified for MySQL and committed as [6674].
Several fixes are required in this report:
$User
becomes'$User'
modified
becomeschangetime
p.value
needs to be cast to integer; I believe the correct SQL isCAST ( p.value AS integer )
though for PostgreSQL only you can usep.value::integer
, which is what I tested it with.