declare
new_count bigint;
begin
select reaction_count into new_count from public.reactioncount
where parent_id = new.parent_id and
reaction_value = new.reaction_type;
new_count = new_count + 1;
update public.reactioncount
set reaction_count = new_count
where parent_id = new.parent_id and
reaction_value = new.reaction_type;
return new, new_count;
end;
declare
new_count bigint;
begin
select reaction_count into new_count from public.reactioncount
where parent_id = new.parent_id and
reaction_value = new.reaction_type;
new_count = new_count + 1;
update public.reactioncount
set reaction_count = new_count
where parent_id = new.parent_id and
reaction_value = new.reaction_type;
return new, new_count;
end;