Strange effect in my view:
I have a list of nodes. On of the fields is a term reference.
- I want the list to only show nodes related to 3 specific terms. that's one filter.
- I want the user to optionally select one of these 3 terms. that's another (exposed) filter.
It almost seems to work. But if the user selects that term from filter 2, in the sql, the first filter is rewritten to explicitly deny that term. zero results. In an almost duplicate display of that view, the same happens, but with one other term (of the same three).
So without selecting anything in filter 2, the sql is:
SELECT DISTINCT bla
FROM
{node} node
...
INNER JOIN {field_data_field_publication_cat} field_data_field_publication_cat ON node.nid = field_data_field_publication_cat.entity_id AND (field_data_field_publication_cat.entity_type = 'node' AND field_data_field_publication_cat.deleted = '0')
...
WHERE (( (node.status = '1') AND (node.type IN ('publication')) AND (field_data_field_publication_cat.field_publication_cat_tid IN ('48', '50', '49')) ))
ORDER BY ... LIMIT .. OFFSET ..
and as soon as I select one of the terms in filter two, it reads
SELECT DISTINCT bla
FROM
{node} node
...
INNER JOIN {field_data_field_publication_cat} field_data_field_publication_cat ON node.nid = field_data_field_publication_cat.entity_id AND (field_data_field_publication_cat.entity_type = 'node' AND field_data_field_publication_cat.deleted = '0')
LEFT JOIN {field_data_field_publication_cat} field_data_field_publication_cat2 ON node.nid = field_data_field_publication_cat2.entity_id AND field_data_field_publication_cat2.field_publication_cat_tid != '48'
...
WHERE (( (node.status = '1') AND (node.type IN ('publication')) AND (field_data_field_publication_cat.field_publication_cat_tid = '48') AND (field_data_field_publication_cat2.field_publication_cat_tid IN ('48', '50', '49')) ))
ORDER BY ... LIMIT .. OFFSET ..
The number 48 in the second query, second join seems fairly random. If I remove and reattach the filter it seems to change.
cat2 is only a left join, but in the where clause, the number 48 is required again. Thats why I get zero results.
What's going on ?
views-sql
:-D