jferrandis
The size field is what we would expect. LIQL queries work a lot like SQL queries.
The query SELECT cover_image FROM messages WHERE id = '59' essentially says give me all messages with the id 59 but only show me their cover image field. So we return the messages which meet the constraint (id = '59') but only include the fields requested (cover_image). In this case there is nothing assigned to cover_images.
Where looking into whether excluding an empty field is the best course of action or if we should return some sort of null or empty value.
A possible work around exists but at the moment it only works if you want a cover image for a single message. I would return images constrained by their association type and message id. It would look like:
SELECT * FROM images WHERE messages.id = '59' AND association_type="cover"
This returns all images used as a cover image in the message with id 59. If none exists the size will be 0 since no images meet that constraints.