Edgewall Software
Modify

Ticket #5543 (closed defect: fixed)

Opened 5 years ago

Last modified 4 years 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@…
Release Notes:
API 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

Change History

comment:1 Changed 5 years ago by Dave Abrahams <dave@…>

  • Component changed from general to report system
  • Owner changed from jonas to mgood
  • 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.

comment:2 Changed 4 years ago by cboos

  • Keywords sql added
  • Milestone set to 0.11.1
  • Severity changed from critical to major
  • Summary changed from Query {6} is broken to Default reports ({6}, {7}, {11} maybe others) are not working for all backends

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

comment:3 Changed 4 years ago by cboos

#5840 was closed as duplicate.

comment:4 Changed 4 years ago by cboos

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

comment:5 Changed 4 years ago by cboos

  • Keywords postgresql added; sql removed
  • Priority changed from normal to high

Another duplicate, #6846.

comment:6 Changed 4 years ago by trac-ja@…

  • Cc trac-ja@… added

comment:7 Changed 4 years 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""" 

comment:8 Changed 4 years ago by cboos

  • Milestone changed from 0.11.1 to 0.11
  • Owner changed from mgood to cboos
  • Status changed from new to 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 Changed 4 years ago by cboos

  • Resolution set to fixed
  • Status changed from assigned to closed

Verified for MySQL and committed as [6674].

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
to The owner will be changed from cboos. Next status will be 'closed'
Author


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

 
Note: See TracTickets for help on using tickets.