This commit is contained in:
Dull Bananas 2023-12-29 02:36:50 +00:00
parent 7d8720ce10
commit 7162c13fac

View file

@ -148,7 +148,9 @@ BEGIN
sum(count_diff) FILTER (WHERE (thing_like).score = 1) AS upvotes, sum(count_diff) FILTER (WHERE (thing_like).score = 1) AS upvotes,
sum(count_diff) FILTER (WHERE (thing_like).score != 1) AS downvotes sum(count_diff) FILTER (WHERE (thing_like).score != 1) AS downvotes
FROM FROM
r.combine_transition_tables () AS (count_diff bigint, thing_like thing_like) r.combine_transition_tables ()
AS (count_diff bigint,
thing_like thing_like)
GROUP BY GROUP BY
(thing_like).thing_id) AS diff (thing_like).thing_id) AS diff
WHERE WHERE
@ -196,12 +198,13 @@ BEGIN
(comment).local, (comment).local,
sum(count_diff) AS comments sum(count_diff) AS comments
FROM FROM
r.combine_transition_tables () AS (count_diff bigint, comment comment) r.combine_transition_tables ()
AS (count_diff bigint,
comment comment)
WHERE WHERE
NOT ((comment).deleted NOT ((comment).deleted OR (comment).removed)
OR (comment).removed)
GROUP BY GROUP BY
GROUPING SETS ((comment)post_id, GROUPING SETS ((comment).post_id,
(comment).creator_id, (comment).creator_id,
(comment).local) (comment).local)
), ),
@ -298,10 +301,11 @@ BEGIN
(post).local, (post).local,
sum(count_diff) AS posts sum(count_diff) AS posts
FROM FROM
r.combine_transition_tables () AS (count_diff bigint, post post) r.combine_transition_tables ()
AS (count_diff bigint,
post post)
WHERE WHERE
NOT ((post).deleted NOT ((post).deleted OR (post).removed)
OR (post).removed)
GROUP BY GROUP BY
GROUPING SETS ((post).community_id, GROUPING SETS ((post).community_id,
(post).creator_id, (post).creator_id,
@ -353,11 +357,9 @@ BEGIN
SELECT SELECT
sum(count_diff) AS communities sum(count_diff) AS communities
FROM FROM
r.combine_transition_tables () AS (count_diff bigint, community community) r.combine_transition_tables ()
WHERE AS (count_diff bigint, community community)
(community).local WHERE (community).local AND NOT ((community).deleted OR (community).removed)) AS diff;
AND NOT ((community).deleted
OR (community).removed)) AS diff;
RETURN NULL; RETURN NULL;
END END
$$; $$;
@ -377,9 +379,9 @@ BEGIN
SELECT SELECT
sum(count_diff) AS users sum(count_diff) AS users
FROM FROM
r.combine_transition_tables () AS (count_diff bigint, person person) r.combine_transition_tables ()
WHERE AS (count_diff bigint, person person)
(person).local) AS diff; WHERE (person).local) AS diff;
RETURN NULL; RETURN NULL;
END END
$$; $$;
@ -448,7 +450,8 @@ BEGIN
(community_follower).community_id, (community_follower).community_id,
sum(count_diff) AS subscribers sum(count_diff) AS subscribers
FROM FROM
r.combine_transition_tables () AS (count_diff bigint, community_follower community_follower) r.combine_transition_tables ()
AS (count_diff bigint, community_follower community_follower)
WHERE ( WHERE (
SELECT SELECT
local local