Comment 21 for bug 421901

Revision history for this message
Robert Collins (lifeless) wrote :

So, it looks like this is the db patch we need:
alter table bugmessage add column owner int;
create index bugmessage__owner__index__idx on bugmessage using btree(owner, index);

We then need a background migration of
this shape:
update bugmessage set owner=message.owner from message where message.id=bugmessage.message;

and finally we can update the 'commented on' query generation to create it like so:
SELECT BugTask.*
FROM BugTask left join product on bugtask.product = product.id, Bug, BugMessage
WHERE
 Bug.id = BugTask.bug
 AND Bug.id = BugMessage.bug
AND BugTask.status in (10, 15, 20, 21, 22, 25)
 AND Bug.duplicateof IS NULL
AND Bug.private = FALSE
AND BugMessage.index > 0
AND BugMessage.owner = 100
and (bugtask.product is null or product.active);