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