This commit is contained in:
Dull Bananas 2023-12-27 22:43:28 +00:00
parent 94e545fe52
commit a27cf8920b
3 changed files with 16 additions and 23 deletions

View file

@ -1,5 +1,2 @@
# Keep normal formatting between `BEGIN` and `COMMIT` statements # Keep normal formatting between `BEGIN` and `COMMIT` statements
nogrouping=1 nogrouping=1
# Don't add whitespace around % (used for `format`) in dollar-quoted function body
placeholder=[a-zA-Z0-9_\\.]*%[a-zA-Z0-9_\\.]*

View file

@ -32,10 +32,10 @@ FROM (
post post
WHERE WHERE
post.id = comment.post_id post.id = comment.post_id
AND (post.deleted OR post.removed) AND (post.deleted
)) OR post.removed)))
GROUP BY GROUP BY
community.id) AS counted community.id) AS counted
WHERE WHERE
community_aggregates.community_id = counted.community_id; community_aggregates.community_id = counted.community_id;

View file

@ -86,19 +86,15 @@ BEGIN
UPDATE UPDATE
thing_report thing_report
SET SET
resolved = TRUE, resolver_id = first_removal.mod_person_id, updated = first_removal.when_ resolved = TRUE, resolver_id = first_removal.mod_person_id, updated = first_removal.when_ FROM (
FROM ( SELECT SELECT
thing_id, thing_id, min(when_) AS when_ FROM new_removal
min(when_) AS when_ WHERE
FROM new_removal new_removal.removed GROUP BY thing_id) AS first_removal
WHERE WHERE
new_removal.removed report.thing_id = first_removal.thing_id
GROUP BY AND NOT report.resolved
thing_id) AS first_removal AND COALESCE(report.updated < first_removal.when_, TRUE);
WHERE
report.thing_id = first_removal.thing_id
AND NOT report.resolved
AND COALESCE(report.updated < first_removal.when_, TRUE);
RETURN NULL; RETURN NULL;
END $$; END $$;
CREATE TRIGGER resolve_reports CREATE TRIGGER resolve_reports
@ -444,15 +440,15 @@ BEGIN
FROM FROM
combine_transition_tables () combine_transition_tables ()
WHERE ( WHERE (
SELECT SELECT
local local
FROM FROM
community community
WHERE WHERE
community.id = community_id community.id = community_id
LIMIT 1) LIMIT 1)
GROUP BY GROUP BY
community_id) AS diff community_id) AS diff
WHERE WHERE
a.community_id = diff.community_id; a.community_id = diff.community_id;
RETURN NULL; RETURN NULL;