Do you have a gallery on the system with an entry that has the same ID as the weblog entry and is tagged? If not then I can understand it working perfectly.
I just did a test: I deleted the tag “fishing” from gallery entry 201 and magically all works perfect.
Here is the SQL: We are viewing a weblog entry but the SQL pulls TAGS FOR the WEBLOG ENTRY and a GALLERY ENTRY
First with Gallery Entry 201 (same id as the weblog entry) tagged with “fishing” - which has nothing to do with the current entry
SELECT exp_weblog_titles.entry_id FROM exp_weblog_titles, exp_weblogs WHERE exp_weblog_titles.weblog_id = exp_weblogs.weblog_id AND exp_weblog_titles.site_id IN ('1') AND exp_weblog_titles.url_title = 'florida-car-insurance' AND exp_weblogs.is_user_blog = 'n'
SELECT t.tag_id, t.tag_name FROM exp_tag_entries te LEFT JOIN exp_tag_tags t ON t.tag_id = te.tag_id WHERE t.site_id IN ('1') AND te.entry_id = '201'
This Step pulls the correct tag "Insurance" and INCORRECTLY pulls the page "fishing" - which is the tag used on gallery entry 201 - which has nothing to do with the current entry.
SELECT DISTINCT(te.entry_id) FROM exp_tag_entries te LEFT JOIN exp_tag_tags t ON t.tag_id = te.tag_id WHERE t.site_id IN ('1') AND te.type = 'weblog' AND te.entry_id != '201' AND ( t.tag_name = 'fishing' OR t.tag_name = 'insurance')
Now here is the SQL after I remove the Tag from the Gallery Entry 201 - all works
SELECT exp_weblog_titles.entry_id FROM exp_weblog_titles, exp_weblogs WHERE exp_weblog_titles.weblog_id = exp_weblogs.weblog_id AND exp_weblog_titles.site_id IN ('1') AND exp_weblog_titles.url_title = 'florida-car-insurance' AND exp_weblogs.is_user_blog = 'n'
SELECT t.tag_id, t.tag_name FROM exp_tag_entries te LEFT JOIN exp_tag_tags t ON t.tag_id = te.tag_id WHERE t.site_id IN ('1') AND te.entry_id = '201'
This Step pulls just the Tag "Insurance" - which is the tag used for the current Entry
SELECT DISTINCT(te.entry_id) FROM exp_tag_entries te LEFT JOIN exp_tag_tags t ON t.tag_id = te.tag_id WHERE t.site_id IN ('1') AND te.type = 'weblog' AND te.entry_id != '201' AND ( t.tag_name = 'insurance')
The Second SQL Statement specifies just the ENTRY ID:
AND te.entry_id = '201'
It seems like the SQL needs to specify the WEBLOG ID (if the entry being viewed is a weblog entry) or the GALLERY ID ( if the entry being viewed is a GALLERY Entry) and only pull both if the Related Entries tag includes both.
My Related entries tag only includes weblog="weblog_name" nothing about a gallery.