Posted by floretan on May 30, 2009 at 2:07am
Jump to:
| Project: | Views Calc |
| Version: | 6.x-1.3 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
Here's how to reproduce the problem:
Create a views_calc field with %node.nid as its value.
Create a node view with the views_calc field that you created.
The following query is generated:
SELECT node.nid AS nid,
(node.nid) AS cid2
FROM node node Now enable the core "content translation" module. The generated query is now:
SELECT node.nid AS nid,
(node.nid) AS cid2
FROM node node
LEFT JOIN node node2 ON node.tnid = node2.tnidWhat happens is that when the content translation module is enabled, the join data from translation.views.inc is used and you end up with a gazillion rows because of the extra join.
This is most likely a bug in views and would appear in any module that tries to do a $query->add_table('node') twice with the content translation module enabled, but I'm posting it here since it really appears in a views_calc context.
Comments
#1
I can confirm this. Also the SUM is multiplied by the number of languages, so 3 languages gives a sum that is 3 times the expected value.
#2
Before I came across this post I created http://drupal.org/node/904038 which pretty much confirms what is being described here.
#3
This might depend the translation mode.
Possibly translation cases currently simply are not supported. I even think, we should call this feature request.