[development] problem with db_rewrite_sql

Earl Miles merlin at logrus.com
Tue Nov 24 16:17:56 UTC 2009


Lluís wrote:
> ok, I have now read "Creative querying".
> 
> Otherwise, I have a problem using "views" and "group by" modules, the
> query is basically a
> 
> "SELECT a, SUM(b) FROM table JOIN... WHERE ... GROUP BY a"
> 
> It works perfectly before db_rewrite_sql (show more rows, but the SUM
> is ok); but after de db_rewrite_sql it show the correct rows but
> SUM(b) is doubled.

Yes, probably because the user is a member of 2 different roles that 
have access, and therefore the GROUP BY ends up counting both. There's a 
problem similar to this in core in counting forum posts, for example. I 
don't know of any solutions to this, either. This is a really 
unfortunate effect of the query we use. :/


More information about the development mailing list