Modify

Opened 17 years ago

Closed 16 years ago

#1934 closed defect (fixed)

TagsPlugin won't display tickets

Reported by: track@… Owned by: Alec Thomas
Priority: normal Component: TagsPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.10

Description

Hi,

I'd installed the plugin as described in install instructions. After the upgrade of trac_env it displays all keywords, including them inside tickets.

But when clicking on a keyword like "resolved" which is only in tickets - no result is displayd. So I checked the database - and in tags table is no entry where tagspace=='ticket'. (But for downloads, wiki, screenshots and so on, them will listed.) I don't understand anymore, why cloud is listed correct, but no entries are in database.

I don't get it solved, have no idea anymore.

Alwin

Attachments (0)

Change History (4)

comment:1 Changed 17 years ago by track@…

forgot:

when setting ONE fields= paramter, eg. "fields = status" then clicking on "Closed" in tags display gives me a list. more than one - no list.

comment:2 in reply to:  1 Changed 17 years ago by track@…

executed

SELECT id, status,severity, COALESCE(status, )
COALESCE(severity, ) AS allfields FROM ticket

-> allfields is always 0 -> no tag found in tickets-list.

I'm using mysql db backend. I debugged the sql-statement,

Trac[ticket] DEBUG: SELECT * FROM (SELECT id, status,severity, COALESCE(status, )
COALESCE(severity, ) AS allfields FROM ticket) s WHERE (allfields LIKE %s) ORDER BY id

this seems to be wrong:

COALESCE(status, )
COALESCE(severity, ) AS allfields - this will not result into colated string in mysql. As in description of sql itself this is right, too. will be a boolean operation, eg. has to result in 0 or 1, sqlite3 is a big exception.

when using CONCAT( COALESCE(

STATUS , ) , COALESCE( severity, ) ) instead
it works in mysql. Yes, I know, sqlite doesn't know about CONCAT :S

So it should be a config-option between sqlite3 or mysql syntax (I don't know how pgsql handles it)

comment:3 Changed 17 years ago by jtpoll@…

Just wanted to chime-in and say that I am also experiencing the same problem -- I'm also using a mysql backend.

I really need this to work, and am too impatient to wait for an official patch that implements sqlite/mysql configuration options. ;) So, I checked out the 0.4.1 tag and made changes to ticket.py in order to get it to work with mysql. The modifications are basically what track@… describes -- the SQL query needs to be changed from:

SELECT * FROM (SELECT id, status,severity, 
  COALESCE(status, '')||COALESCE(severity, '') AS allfields 
   FROM ticket) s 
   WHERE (allfields LIKE %s) 
   ORDER BY id

to

SELECT * FROM (SELECT id, status,severity, 
  CONCAT(COALESCE(status, ''), COALESCE(severity, '')) AS allfields 
   FROM ticket) s 
   WHERE (allfields LIKE %s) 
   ORDER BY id

A filthy-hack patch that gets it working in lieu of a sqlite3/mysql configuration option is:

Index: tractags/ticket.py
===================================================================
--- tractags/ticket.py  (revision 2580)
+++ tractags/ticket.py  (working copy)
@@ -29,8 +29,8 @@
         tags = set(tags)
         names = set(names)
         args = []
-        sql = "SELECT * FROM (SELECT id, %s, %s AS allfields FROM ticket) s" % (','.join(self.fields),
-            '||'.join(["COALESCE(%s, '')" % f for f in self.fields]))
+        sql = "SELECT * FROM (SELECT id, %s, CONCAT(%s) AS allfields FROM ticket) s" % (','.join(self.fields),
+            ','.join(["COALESCE(%s, '')" % f for f in self.fields]))
         constraints = []
         if names:
             constraints.append("id IN (" + ', '.join(['%s' for n in names]) + ")")

I look forward to an official patch, though. :)

comment:4 Changed 16 years ago by Alec Thomas

Resolution: fixed
Status: newclosed

This should be fixed in trunk.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Alec Thomas.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.