What relationship determines which images appear in ‘uploaded to post’ in edit/add post media dialog

Solved it! It was an issue with the Polylang plugin stopping the image from showing, I’m not quite sure why but adding a row to the wp_term_relationships table, where the object_id is the id of the attachment, and the term_taxonomy_id is the id of the language definition in the wp_term_taxonomy table fixed the issue.