Show all (my, their, everyone's) uploads

Just a tip, when you are joining tables, it is more readable to use the “JOIN ... ON” syntax

   SELECT CONCAT('<a href = "/p/', posts.id, '">', topics.title) AS html$post
        , CONCAT('<img src="', url, E'" style = "max-width: 100%\x3B">') AS html$Image
     FROM post_uploads
     JOIN uploads ON uploads.id = post_uploads.upload_id
     JOIN posts   ON posts.id   = post_uploads.post_id
     JOIN topics  ON topics.id  = posts.topic_id
    WHERE DATE(current_date) - DATE(uploads.created_at) < 7   
      AND topics.archetype = 'regular'
 ORDER BY uploads.created_at DESC

That way, you’re making it clear that you’re joining several tables and what columns you used.

9 Likes