Steps to reproduce
1.Create a content type with node referenced field.
2.Create View of block type for the new content type.
3.Set a contextual filter on node referenced field.
4.Try to enter an id into "Preview with contextual filters:" field
5.Click "Update preview"
"SQLSTATE: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS field_data_field_rating_, node.uid AS node_uid, node.created AS node_created,' at line 1"