Watchdog has 2 instances of the uid column when using this query:
SELECT w.*, u.uid FROM {watchdog} w INNER JOIN {users} u ON w.uid = u.uid;
Patch updates this query to:
SELECT w.severity, w.type, w.timestamp, w.message, w.link, u.name FROM {watchdog} w INNER JOIN {users} u ON w.uid = u.uid
The columns are enumerated because its generally good practice in high performance SQL coding to enumerate your columns (no matter how many) so the database doesn't have to do a call to its system table to review all the columns in the tables and their types and act accordingly. By enumerating, it grabs the column by index (hash prob.) from the system table which contains the column name, type.
Comments
Comment #1
moshe weitzman commentedthe nwe query omits *both* uid columns. is that intended. if so, this is a reasonable change.
Comment #2
Souvent22 commentedThanks. You're right, it does omit both..as it should..however, I DID forget the wid column. Re-rolled patch.
I looked through the code ( which is quoted below for easy review), and uid is not used anywhere.
Comment #3
Souvent22 commentedJust reviewed and tested the patch. uid is used in the theme('username', $obj) function. w/o uid, it will still display the username, but withe a (not verified) clause. Fixed with this patch. that should be it.
Comment #4
moshe weitzman commenteduid is needed by this line: theme('username', $watchdog). after that, looks RTBC to me.
Comment #5
m3avrck commentedSeems Souvent22 and Moshe cross posted each other.
Comment #6
m3avrck commentedAlso as a note, we should look into carrying this practice throughout core (more small patches like this that are easy to digest) and updating the coding guidelines. Seems like a nice and easy small performance gain.
Comment #7
dries commentedCommitted to CVS HEAD. Thanks.
Comment #8
(not verified) commented