Differences From
Artifact [54b7851d27]:
70 70 body text,
71 71 posted bigint,
72 72 discovered bigint,
73 73 edited bigint,
74 74 parent bigint,
75 75 convoheaduri text,
76 76 chgcount integer,
77 +-- ephemeral
77 78 accent smallint,
78 79 rtdby bigint, -- note that these must be 0 if the record
79 80 rtid bigint, -- in question does not represent an RT!
80 81 n_likes integer,
81 - n_rts integer
82 + n_rts integer,
83 + isreply bool -- true if parent in (table posts); saves us a bunch of queries
82 84 );
83 85
84 86 create or replace function
85 87 pg_temp.parsavpg_translate_post(parsav_posts,bigint,bigint)
86 88 returns pg_temp.parsavpg_intern_post as $$
87 89 select a.origin is null,
88 90 ($1).id, ($1).author,
89 91 ($1).subject,($1).acl, ($1).body,
90 92 ($1).posted, ($1).discovered, ($1).edited,
91 93 ($1).parent, ($1).convoheaduri,($1).chgcount,
92 94 coalesce(c.value, -1)::smallint,
93 95 $2 as rtdby, $3 as rtid,
94 - re.likes, re.rts
96 + re.likes, re.rts,
97 + ($1).parent in (select id from parsav_posts)
95 98 from parsav_actors as a
96 99 left join parsav_actor_conf_ints as c
97 100 on c.key = 'ui-accent' and
98 101 c.uid = a.id
99 102 left join pg_temp.parsavpg_post_react_counts as re
100 103 on re.post = ($1).id
101 104 where a.id = ($1).author