Edgewall Software

Ticket #5543 (closed defect: fixed)

Opened 19 months ago

Last modified 10 months ago

Default reports ({6}, {7}, {11} maybe others) are not working for all backends

Reported by: Dave Abrahams <dave@…> Owned by: cboos
Priority: high Milestone: 0.11
Component: report system Version: devel
Severity: major Keywords: postgresql
Cc: trac-ja@…

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

Change History

Changed 18 months ago by Dave Abrahams <dave@…>

  • owner changed from jonas to mgood
  • component changed from general to report system
  • severity changed from normal to critical

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.

Changed 13 months ago by cboos

  • keywords sql added
  • summary changed from Query {6} is broken to Default reports ({6}, {7}, {11} maybe others) are not working for all backends
  • severity changed from critical to major
  • milestone set to 0.11.1

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

Changed 13 months ago by cboos

#5840 was closed as duplicate.

Changed 13 months ago by cboos

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

Changed 11 months ago by cboos

  • keywords postgresql added; sql removed
  • priority changed from normal to high

Another duplicate, #6846.

Changed 10 months ago by trac-ja@…

  • cc trac-ja@… added

Changed 10 months ago by trac-ja@…

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""" 

Changed 10 months ago by cboos

  • owner changed from mgood to cboos
  • status changed from new to assigned
  • milestone changed from 0.11.1 to 0.11

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.

Changed 10 months ago by cboos

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

Verified for MySQL and committed as [6674].

Add/Change #5543 (Default reports ({6}, {7}, {11} maybe others) are not working for all backends)

Author



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