Hi,

Not sure exactly why this is happening, but I thought I'd raise it here first. Please let me know if I should be raising this elsewhere.

I installed Site notes onto my existing Drupal installation which contains the flag module. Before I installed Site notes, flags were working for all users. I am user 1 and I did not give any other role the access control to use site notes. Flags still work for me, but for all other users, flagging a node causes the following php error in the drupal logs (reformatted for easier reading):

Column 'type' in where clause is ambiguous query: 

SELECT 
	node.nid, 
	node.title AS node_title, 
	node.changed AS node_changed, 
	node_comment_statistics.comment_count AS node_comment_statistics_comment_count, 
	node_comment_statistics.last_comment_timestamp AS node_comment_statistics_last_comment_timestamp, 
	flag_types_forum_watch.type AS flag_types_forum_watch_type, 
	flag_ops_forum_watch.uid AS flag_ops_forum_watch_ops 
FROM 
	node node 
	LEFT JOIN flag_content flag_content_forum_watch ON node.nid = flag_content_forum_watch.content_id AND flag_content_forum_watch.fid = '2' 
	LEFT JOIN node_comment_statistics node_comment_statistics ON node.nid = node_comment_statistics.nid 
	LEFT JOIN flag_types flag_types_forum_watch ON node.type = flag_types_forum_watch.type AND flag_types_forum_watch.fid = '2' 
	LEFT JOIN flag_content flag_ops_forum_watch ON node.nid = flag_ops_forum_watch.content_id AND flag_ops_forum_watch.fid = '2' AND flag_ops_forum_watch.uid = '46' 
WHERE 
	(type <> 'sitenotes') 
	AND ( (node.status = '1') 
	AND (flag_content_forum_watch.uid IS NOT NULL) 
	AND (flag_content_forum_watch.uid = 46) ) LIMIT 0, 5 

The problem is caused by the WHERE type <> 'sitenotes' because both the node and flag_types tables have columns named "type".

I'm not sure whether the sitenodes module is responsible for injecting the SQL into the WHERE clause, but if it did, would it be possible for you to prefix the type column to remove ambiguity? i.e. node.type <> 'sitenotes'

I think this is a great module but have unfortunately had to completely uninstall it as a short term fix to get my flags working again.

Cheers,
Steve

Comments

nancydru’s picture

Status: Active » Closed (duplicate)