getting first comment from longdescs for RSS support

Myk Melez myk at mozilla.org
Fri Feb 11 08:16:24 UTC 2005


Jason Remillard wrote:

> I am working on the RSS support for bugzilla (Bug 82878). I would like 
> to get the first comment as the long description for the RSS entry. I 
> seem to be able to do this ok from the mysql command prompt.
>
> select longdescs.thetext
> from longdescs, bugs
> where longdescs.bug_when = bugs.creation_ts and bugs.bug_id = ?
>
> Is this the best way to get the comment 0 from a bug.

A better way may be to select all comments, ordered chronographically, 
with the result set limited to one row, i.e. something like:

SELECT longdescs.thetext FROM longdescs, bugs WHERE longdescs.bug_id = 
bugs.bug.id ORDER BY longdescs.bug_when LIMIT 1;

> Are the time stamps going to match to insure that the query will 
> always work?

Apparently not, at least not on b.m.o, where 25K out of 281K bugs 
(almost 10%) have no comment with the same creation timestamp as the bug:

mysql> select count(*) from bugs join longdescs on bugs.bug_id = 
longdescs.bug_id and bugs.creation_ts = longdescs.bug_when;

+----------+
| count(*) |
+----------+
|   255390 |
+----------+
1 row in set (1 min 10.38 sec)

mysql> select count(*) from bugs;
+----------+
| count(*) |
+----------+
|   281731 |
+----------+
1 row in set (0.00 sec)

> It looks like I can do this just from the large DefineColumn table in 
> buglist.cgi, and stay out of the Search.pm code. Correct?

I'm not sure you'll be able to stay out of the Search.pm code, but it's 
worth a shot.

-myk




More information about the developers mailing list