Skip to content

Instantly share code, notes, and snippets.

create or replace function mutation_comments_trigger() returns trigger as $$
declare
c record;
parent_type text;
begin
if (tg_op = 'DELETE') then
if old.parent_type = 'task' then
delete from data.task_comment where id = old.id;
if not found then return null; end if;
elsif old.parent_type = 'project' then