Edgewall Software
Modify

Opened 17 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: Dave Abrahams <dave@…> 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 Dave Abrahams <dave@…>, 17 years ago

Component: generalreport system
Owner: changed from Jonas Borgström to Matthew Good
Severity: normalcritical

Several fixes are required in this report:

  1. $User becomes '$User'
  2. modified becomes changetime
  3. p.value needs to be cast to integer; I believe the correct SQL is CAST ( p.value AS integer ) though for PostgreSQL only you can use p.value::integer, which is what I tested it with.

comment:2 by Christian Boos, 17 years ago

Keywords: sql added
Milestone: 0.11.1
Severity: criticalmajor
Summary: Query {6} is brokenDefault reports ({6}, {7}, {11} maybe others) are not working for all backends

#5644, #6334 and #6491 were closed as duplicates.

comment:3 by Christian Boos, 17 years ago

#5840 was closed as duplicate.

comment:4 by Christian Boos, 17 years ago

#5756 was closed as duplicate (mentions the same fix as suggested in comment:1)

comment:5 by Christian Boos, 17 years ago

Keywords: postgresql added; sql removed
Priority: normalhigh

Another duplicate, #6846.

comment:6 by trac-ja@…, 17 years ago

Cc: trac-ja@… added

comment:7 by trac-ja@…, 17 years ago

I encount this bug at {6} with native stacktrace. ({7} runs normally.)

There are two problems:

  1. SQL compatibility
  2. 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

     
    280280  FROM ticket t
    281281  LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority'
    282282  ORDER BY (milestone IS NULL), milestone DESC, (status = 'closed'),
    283         (CASE status WHEN 'closed' THEN modified ELSE (-1)*p.value END) DESC
    284 """),
     283        (CASE status WHEN 'closed' THEN changetime ELSE (-1) * %s END) DESC
     284""" % db.cast('p.value', 'int')),
    285285#----------------------------------------------------------------------------
    286286('My Tickets',
    287287"""

comment:8 by Christian Boos, 17 years ago

Milestone: 0.11.10.11
Owner: changed from Matthew Good to Christian Boos
Status: newassigned

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 Christian Boos, 17 years ago

Resolution: fixed
Status: assignedclosed

Verified for MySQL and committed as [6674].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.