{"action":"created","issue":{"url":"https://api.github.com/repos/pods-framework/pods/issues/2582","labels_url":"https://api.github.com/repos/pods-framework/pods/issues/2582/labels{/name}","comments_url":"https://api.github.com/repos/pods-framework/pods/issues/2582/comments","events_url":"https://api.github.com/repos/pods-framework/pods/issues/2582/events","html_url":"https://github.com/pods-framework/pods/issues/2582","id":53627745,"number":2582,"title":"Related meta_value traversal not completing in find() with array params.","user":{"login":"Desertsnowman","id":307466,"avatar_url":"https://avatars.githubusercontent.com/u/307466?v=3","gravatar_id":"","url":"https://api.github.com/users/Desertsnowman","html_url":"https://github.com/Desertsnowman","followers_url":"https://api.github.com/users/Desertsnowman/followers","following_url":"https://api.github.com/users/Desertsnowman/following{/other_user}","gists_url":"https://api.github.com/users/Desertsnowman/gists{/gist_id}","starred_url":"https://api.github.com/users/Desertsnowman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Desertsnowman/subscriptions","organizations_url":"https://api.github.com/users/Desertsnowman/orgs","repos_url":"https://api.github.com/users/Desertsnowman/repos","events_url":"https://api.github.com/users/Desertsnowman/events{/privacy}","received_events_url":"https://api.github.com/users/Desertsnowman/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pods-framework/pods/labels/Bug:%20Normal","name":"Bug: Normal","color":"e10c02"},{"url":"https://api.github.com/repos/pods-framework/pods/labels/Needs%20Contributor","name":"Needs Contributor","color":"DDDDDD"},{"url":"https://api.github.com/repos/pods-framework/pods/labels/Needs%20Research","name":"Needs Research","color":"DDDDDD"},{"url":"https://api.github.com/repos/pods-framework/pods/labels/Needs%20Unit%20Test","name":"Needs Unit Test","color":"e102d8"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/pods-framework/pods/milestones/54","labels_url":"https://api.github.com/repos/pods-framework/pods/milestones/54/labels","id":924652,"number":54,"title":"Pods 2.5.2","description":"","creator":{"login":"Shelob9","id":1994311,"avatar_url":"https://avatars.githubusercontent.com/u/1994311?v=3","gravatar_id":"","url":"https://api.github.com/users/Shelob9","html_url":"https://github.com/Shelob9","followers_url":"https://api.github.com/users/Shelob9/followers","following_url":"https://api.github.com/users/Shelob9/following{/other_user}","gists_url":"https://api.github.com/users/Shelob9/gists{/gist_id}","starred_url":"https://api.github.com/users/Shelob9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shelob9/subscriptions","organizations_url":"https://api.github.com/users/Shelob9/orgs","repos_url":"https://api.github.com/users/Shelob9/repos","events_url":"https://api.github.com/users/Shelob9/events{/privacy}","received_events_url":"https://api.github.com/users/Shelob9/received_events","type":"User","site_admin":false},"open_issues":22,"closed_issues":10,"state":"open","created_at":"2015-01-06T23:17:22Z","updated_at":"2015-01-28T21:52:42Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2015-01-07T12:31:41Z","updated_at":"2015-01-30T15:30:17Z","closed_at":null,"body":"When doing a find using the following:\r\n```PHP\r\n\t$params = array(\r\n\t\t\"where\"\t=> array(\r\n\t\t\tarray(\r\n\t\t\t\t\"field\"\t  => \"location.country\",\r\n\t\t\t\t\"value\"   => \"ZA\",\r\n\t\t\t\t\"compare\" => \"=\"\r\n\t\t\t)\r\n\t\t)\r\n\t);\r\n```\r\nThe query traverses correctly joins ``` `wp_postmeta` AS `location_country` ON `location_country`.`meta_key` = 'country' ``` but it doesn't add the meta_value compare in the WHERE. Instead it keeps the traversal syntax ``` WHERE ( ( `location`.`country` = 'ZA' )...``` resulting in a \"Unknown column 'location.country' in 'where clause'\"\r\nHere's the full SQL generated:\r\n```SQL\r\nSELECT DISTINCT\r\n`t`.*\r\nFROM `wp_posts` AS `t`\r\n\r\n    LEFT JOIN `wp_podsrel` AS `rel_location` ON\r\n        `rel_location`.`field_id` = 1898\r\n        AND `rel_location`.`item_id` = `t`.`ID`\r\n\r\n    LEFT JOIN `wp_posts` AS `location` ON\r\n        `location`.`ID` = `rel_location`.`related_item_id`\r\n\r\n\r\n    LEFT JOIN `wp_postmeta` AS `location_country` ON\r\n        `location_country`.`meta_key` = 'country'\r\n        AND `location_country`.`post_id` = `location`.`ID`\r\n\r\nWHERE ( ( `location`.`country` = 'ZA' ) AND ( `t`.`post_type` = \"review\" ) AND ( `t`.`post_status` IN ( \"publish\" ) ) )\r\n\r\n\r\nORDER BY `t`.`menu_order`, `t`.`post_title`, `t`.`post_date`\r\n```"},"comment":{"url":"https://api.github.com/repos/pods-framework/pods/issues/comments/72218298","html_url":"https://github.com/pods-framework/pods/issues/2582#issuecomment-72218298","issue_url":"https://api.github.com/repos/pods-framework/pods/issues/2582","id":72218298,"user":{"login":"sc0ttkclark","id":709662,"avatar_url":"https://avatars.githubusercontent.com/u/709662?v=3","gravatar_id":"","url":"https://api.github.com/users/sc0ttkclark","html_url":"https://github.com/sc0ttkclark","followers_url":"https://api.github.com/users/sc0ttkclark/followers","following_url":"https://api.github.com/users/sc0ttkclark/following{/other_user}","gists_url":"https://api.github.com/users/sc0ttkclark/gists{/gist_id}","starred_url":"https://api.github.com/users/sc0ttkclark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sc0ttkclark/subscriptions","organizations_url":"https://api.github.com/users/sc0ttkclark/orgs","repos_url":"https://api.github.com/users/sc0ttkclark/repos","events_url":"https://api.github.com/users/sc0ttkclark/events{/privacy}","received_events_url":"https://api.github.com/users/sc0ttkclark/received_events","type":"User","site_admin":false},"created_at":"2015-01-30T15:30:17Z","updated_at":"2015-01-30T15:30:17Z","body":"Sounds like country is a simple relationship field using the states list, which indeed will need selecting .meta_value because location isn't a table-based Pod (or else it would be `location.d.country`)"}}