For example,
'SELECT "t1"."id", "t1"."name", "t1"."repository_id", "t1"."manifest_id", "t1"."lifetime_start_ms", "t1"."lifetime_end_ms", "t1"."hidden", "t1"."reversion", "t1"."tag_kind_id", "t1"."linked_tag_id" FROM "tag" AS "t1" INNER JOIN "repository" AS "t2" ON ("t1"."repository_id" = "t2"."id") INNER JOIN "user" AS "t3" ON ("t2"."namespace_user_id" = "t3"."id") WHERE ((("t1"."repository_id" = 1851) AND NOT ("t1"."lifetime_end_ms" IS None)) AND ("t1"."lifetime_end_ms" <= (1625841756272 - ("t3"."removed_tag_expiration_s" * 1000)))) LIMIT 10'
will raise an integer too large exception because of
("t1"."lifetime_end_ms" <= (1625841756272 - ("t3"."removed_tag_expiration_s" * 1000)))
We should either add a check to make sure that the conversion to ms fits in an integer, or find a way for postgres to treat the result of the operation as a bigint.