-- -- template_demo_note__new/9 -- create or replace function template_demo_note__new( integer, character varying, character varying, character varying, character varying, timestamp with time zone, integer, character varying, integer ) returns int4 as $$ declare p_template_demo_note_id alias for $1; -- default null p_title alias for $2; p_body alias for $3; p_color alias for $4; p_object_type alias for $5; -- default 'template_demo_note' p_creation_date alias for $6; -- default now() p_creation_user alias for $7; -- default null p_creation_ip alias for $8; -- default null p_context_id alias for $9; -- default null v_template_demo_note_id template_demo_notes.template_demo_note_id%TYPE; begin v_template_demo_note_id := acs_object__new ( p_template_demo_note_id, p_object_type, p_creation_date, p_creation_user, p_creation_ip, p_context_id ); insert into template_demo_notes (template_demo_note_id, title, body, color) values (v_template_demo_note_id, p_title, p_body, p_color); if p_creation_user is not null then PERFORM acs_permission__grant_permission( v_template_demo_note_id, p_creation_user, 'admin' ); end if; return v_template_demo_note_id; end;$$ language plpgsql;