Download & Extend

Column 'value' in field list is ambiguous query

Project:Voting API
Version:6.x-2.3
Component:Views Integration
Category:bug report
Priority:critical
Assigned:Unassigned
Status:active

Issue Summary

I have a view that outputs the following SQL.

SELECT node.nid AS nid,
   node.title AS node_title,
   node_revisions.body AS node_revisions_body,
   node_revisions.format AS node_revisions_format,
   value,
   profile_values_profile_name.value AS profile_values_profile_name_value,
   votingapi_cache_node_sum.value_type AS votingapi_cache_node_sum_value_type
FROM node node
LEFT JOIN votingapi_cache votingapi_cache_node_sum ON node.nid = votingapi_cache_node_sum.content_id AND (votingapi_cache_node_sum.content_type = 'node' AND votingapi_cache_node_sum.function = 'sum')
LEFT JOIN node_revisions node_revisions ON node.vid = node_revisions.vid
INNER JOIN users users ON node.uid = users.uid
LEFT JOIN profile_values profile_values_profile_name ON users.uid = profile_values_profile_name.uid AND profile_values_profile_name.fid = '1'
WHERE (node.status <> 0) AND (node.type in ('idea')) AND (node.status <> 0)
   ORDER BY node_title ASC

As you can see by the SQL above the "value" in the SELECT is missing the table prefix "votingapi_cache_node_sum.". Interestingly enough though votingapi_cache_node_sum.value_type does have the correct prefix. The problem not having the prefix means that value is in fact ambiguous across the joined tables.
AttachmentSize
Picture 2.png111.61 KB
nobody click here