FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Bug Reports » SQL bug in default theme
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: SQL bug in default theme [message #34902 is a reply to message #34892] Wed, 22 November 2006 16:44 Go to previous messageGo to previous message
jyoder is currently offline  jyoder   United States
Messages: 5
Registered: November 2006
Location: Michigan, USA
Karma:
Junior Member
Ilia wrote on Wed, 22 November 2006 10:12

This bug was fixed in CVS earlier, the official patch can be found here:
http://cvs.prohost.org/c/index.cgi/FUDforum/chngview?cn=11611


That fix merely made the number of parenthesis match, the resulting SQL is still broken. Here's the error you get:

ERROR:  argument of OR must be type boolean, not type integer


Which is due to the WHERE clause:

WHERE (mo.id IS NOT NULL OR (COALESCE(g2.group_cache_opt, g1.group_cache_opt)) & 1)>0


This ties the
>0
to the entire WHERE clause and not just the result of the COALESCE as intended.

My patch results in the following WHERE clauses (depending on the options) :

WHERE  (mo.id IS NOT NULL OR (COALESCE(g2.group_cache_opt, g1.group_cache_opt) & 1)>0) 

OR
WHERE  ((g1.group_cache_opt & 1)>0)


Obviously the outer ()'s aren't required, but this was the least number of characters I could change to fix the statement.

EDIT: On further reflection, removing the outer parenthesis makes it a 2 character patch instead of 3 Smile
                        ((!$is_a || $cat_id) ?  ' WHERE ' : '') .
-                       ($is_a ? '' : (_uid ? ' (mo.id IS NOT NULL OR (COALESCE(g2.group_cache_opt, g1.group_cache_opt))' : ' (g1.group_cache_opt').' & 1)>0') .
+                       ($is_a ? '' : (_uid ? ' mo.id IS NOT NULL OR (COALESCE(g2.group_cache_opt, g1.group_cache_opt)' : ' (g1.group_cache_opt').' & 1)>0') .
                        ($cat_id ? ($is_a ? '' : ' AND ') . ' v.c IN('.implode(',', ($cf = $cidxc[$cat_id][5])).') ' : '').' ORDER BY v.id');


Thanks!

[Updated on: Wed, 22 November 2006 16:55]

Report message to a moderator

[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: problems with CSS after changing document root for FUDforum
Next Topic: Inbox - Sort by xxxxxxx
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Dec 05 02:43:20 GMT 2024

Total time taken to generate the page: 0.04320 seconds