-- -- content_type__unregister_template/3 -- create or replace function content_type__unregister_template( character varying, integer, character varying ) returns int4 as $$ declare unregister_template__content_type alias for $1; -- default null unregister_template__template_id alias for $2; unregister_template__use_context alias for $3; -- default null begin if unregister_template__use_context is null and unregister_template__content_type is null then delete from cr_type_template_map where template_id = unregister_template__template_id; else if unregister_template__use_context is null then delete from cr_type_template_map where template_id = unregister_template__template_id and content_type = unregister_template__content_type; else if unregister_template__content_type is null then delete from cr_type_template_map where template_id = unregister_template__template_id and use_context = unregister_template__use_context; else delete from cr_type_template_map where template_id = unregister_template__template_id and content_type = unregister_template__content_type and use_context = unregister_template__use_context; end if; end if; end if; return 0; end;$$ language plpgsql;