2

When I preview my view, I get an error and notice that the view signature in the query was added twice. The one that's an issue is:

':default' AS view_name

Here is the full query.

SELECT DISTINCT taxonomy_term_data.tid AS tid, taxonomy_term_data.name AS taxonomy_term_data_name, taxonomy_term_data.vid AS taxonomy_term_data_vid, taxonomy_vocabulary.machine_name AS taxonomy_vocabulary_machine_name, 'video_categories:block' AS view_name
FROM {taxonomy_term_data} taxonomy_term_data
INNER JOIN {node} node_taxonomy_term_data ON (SELECT nodeINNER.nid AS nidINNER, ':default' AS view_name
FROM {node} nodeINNER
LEFT JOIN {taxonomy_index} taxonomy_indexINNER ON nodeINNER.nid = taxonomy_indexINNER.nid
LEFT JOIN {taxonomy_term_data} taxonomy_term_data_nodeINNER ON taxonomy_indexINNER.tid = taxonomy_term_data_nodeINNER.tid
WHERE (( (taxonomy_term_data_nodeINNER.tid = taxonomy_term_data.tid ) ))
ORDER BY nodeINNER.nid DESC
LIMIT 1 OFFSET 0) = node_taxonomy_term_data.nid
LEFT JOIN {taxonomy_vocabulary} taxonomy_vocabulary ON taxonomy_term_data.vid = taxonomy_vocabulary.vid
WHERE (( (taxonomy_vocabulary.machine_name IN  ('video_category')) ))

The error I get is:

SQLSTATE[21000]: Cardinality violation: 1241 Operand should contain 2 column(s)

Which makes sense since I am not expecting the second parameter to be in there for view_name. Why does it do this and how do I stop this feature from adding the view_name to the inner join on my query?

When I uncheck this box, the query works as expected, however, I use the signature in my reporting to quickly identify issues, slow queries etc.

  • How are you doing the sub query with Views?5 – mpdonadio May 1 '14 at 22:15
  • Not sure what you mean exactly, but the change to the view is adding "Taxonomy term: Representative node" as a relatinoship based on the Nid. – Donovan May 2 '14 at 17:18
  • OK, I just don't recall ever seeing Views make a sub-SELECT (the ON clause starting on the third line of the query). – mpdonadio May 2 '14 at 17:24
0

The issue was the relationship added to the view. I removed the relationship and this fixed my issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.