begin
if new.is_default = 't' then
update
cr_type_template_map
set
is_default = 'f'
where
content_type = new.content_type
and
use_context = new.use_context
and
template_id <> new.template_id
and
is_default = 't';
end if;
return new;
end;