Opened 9 years ago

Closed 9 years ago

#4929 closed defect (fixed)

Sample report does not work with PostgreSQL 8.3

Reported by: christian@… Owned by: Vladislav Naumov
Priority: normal Component: TracUnreadPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11


The included sample report does not work with pg 8.3 as integers are no longer automaticly cast to varchars. I have made two minor changes to make it work with 8,3:

	SELECT p.value AS __color__,
 	   (CASE status WHEN 'assigned' THEN 'Assigned' ELSE 'Owned' END) AS __group__, AS ticket, summary, component,
 	   priority, time AS _created,
 	   changetime AS modified,
 	   reporter AS _reporter
 	   , CASE
 	    WHEN u.last_read_on IS NULL OR u.last_read_on < t.time
 	    THEN '[ticket:' || cast( as varchar) || ' new ticket]'
 	    WHEN u.last_read_on > t.changetime
 	    THEN 'no unread'
 	    ELSE '[comment:ticket:' || cast( as varchar) || ':' || (
 	        -- fetch unread comment number
 	            -- Thanks for recording parent.child relationship, guys!
 	            WHEN position('.' in oldvalue) != 0 THEN split_part(oldvalue, '.', 2)
 	            ELSE oldvalue
 	        FROM ticket_change tc
 	        WHERE field = 'comment'
 	          AND ticket =
 	          AND time > u.last_read_on
 	        ORDER BY time
 	        LIMIT 1
	      ) || ' unread comment]'
 	    AS description
 	  FROM ticket t
 	  LEFT JOIN enum p ON = t.priority AND p.type = 'priority'
 	  LEFT JOIN trac_unread u ON (
 	    AND u.type = 'ticket'
 	    AND u.username = '$USER'
 	  WHERE t.status IN ('new', 'assigned', 'reopened') AND owner = '$USER'
 	  ORDER BY description, CAST(p.value AS integer), milestone, t.type, time

Also please note that I changed the order by clause to reflect my needs.

Otherwise: Great plugin - thx

Attachments (0)

Change History (1)

comment:1 Changed 9 years ago by Vladislav Naumov

Resolution: fixed
Status: newclosed

Thanks, Christian!

Fixed in revision 5523.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Vladislav Naumov.
The resolution will be deleted.

Add Comment

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

Note: See TracTickets for help on using tickets.