Original query:

SELECT "main"."ID" "ID", "main"."name" "name", "ass"."name" "assigneduser_name", "main"."assigneduser" "assigneduser", "main"."url" "url", "main"."username" "username", "main"."password" "password", "eba72893320b2660a9d9c71ba74b09ab", "fa027bc5d6ce26f1f91a3e934b246cdc", "follow"."ID" "follow"
FROM (SELECT "main"."ID" "ID", "main"."name" "name", "main"."assigneduser" "assigneduser", "main"."url" "url", "main"."username" "username", "main"."password" "password"
FROM "links" "main"
WHERE ((("main"."ownergroup" IN (1, 2, 11, 12) OR "main"."owneruser" = 1005 OR ("main"."owneruser" IS NULL AND "main"."ownergroup" IS NULL) OR "main"."assigneduser" = 1005) AND "main"."visibility" = '0'))
ORDER BY "main"."name", "main"."ID"
LIMIT 100) "main"
LEFT JOIN LATERAL (SELECT "ID" FROM "follows" WHERE ("creator" = 1005 AND "entity" = 'links' AND "index" = "main"."ID")) "follow" ON TRUE
LEFT JOIN "users" "ass" ON "ass"."ID" = "main"."assigneduser"
LEFT JOIN LATERAL (SELECT "value" "fa027bc5d6ce26f1f91a3e934b246cdc" FROM "extdata" WHERE ("entity" = 'links' AND "index" = "main"."ID" AND "name" IN ('ertretret') AND "value" <> '')) "extdata" ON TRUE
LEFT JOIN LATERAL (SELECT 1 "eba72893320b2660a9d9c71ba74b09ab" FROM "tags" WHERE ("entity" = 'links' AND "index" = "main"."ID" AND (("name" = 'test' OR "name" ~~ 'test/%')))) "tags" ON TRUE
ORDER BY "main"."name", "main"."ID"

Prettified:

SELECT
  "main"."ID" AS ID,
  "main"."name" AS name,
  "ass"."name" AS assigneduser_name,
  "main"."assigneduser" AS assigneduser,
  "main"."url" AS url,
  "main"."username" AS username,
  "main"."password" AS password,
  "eba72893320b2660a9d9c71ba74b09ab",
  "fa027bc5d6ce26f1f91a3e934b246cdc",
  "follow"."ID" AS follow
FROM
  (
    SELECT
      "main"."ID" AS ID,
      "main"."name" AS name,
      "main"."assigneduser" AS assigneduser,
      "main"."url" AS url,
      "main"."username" AS username,
      "main"."password" AS password
    FROM
      "links" main
    WHERE
      (
        "main"."ownergroup" IN (1, 2, 11, 12) OR
        "main"."owneruser" = 1005 OR
        (
          "main"."owneruser" IS NULL AND
          "main"."ownergroup" IS NULL
        ) OR
        "main"."assigneduser" = 1005
      ) AND
      "main"."visibility" = '0'
    ORDER BY
      "main"."name",
      "main"."ID"
    LIMIT
      100
  ) main
  LEFT JOIN (
    SELECT
      "ID"
    FROM
      "follows"
    WHERE
      "creator" = 1005 AND
      "entity" = 'links' AND
      "index" = "main"."ID"
  ) follow ON true
  LEFT JOIN "users" ass ON ("ass"."ID" = "main"."assigneduser")
  LEFT JOIN (
    SELECT
      "value" AS fa027bc5d6ce26f1f91a3e934b246cdc
    FROM
      "extdata"
    WHERE
      "entity" = 'links' AND
      "index" = "main"."ID" AND
      "name" IN ('ertretret') AND
      "value" <> ''
  ) extdata ON true
  LEFT JOIN (
    SELECT
      1 AS eba72893320b2660a9d9c71ba74b09ab
    FROM
      "tags"
    WHERE
      "entity" = 'links' AND
      "index" = "main"."ID" AND
      (
        "name" = 'test' OR
        "name" ~~ 'test/%'
      )
  ) tags ON true
ORDER BY
  "main"."name",
  "main"."ID"