29 lines
1.1 KiB
PL/PgSQL
29 lines
1.1 KiB
PL/PgSQL
CREATE OR REPLACE FUNCTION medreport.update_account(p_name character varying, p_last_name text, p_personal_code text, p_phone text, p_city text, p_has_consent_personal_data boolean, p_uid uuid, p_email character varying)
|
|
RETURNS void
|
|
LANGUAGE plpgsql
|
|
AS $function$begin
|
|
update medreport.accounts
|
|
set name = coalesce(p_name, name),
|
|
last_name = coalesce(p_last_name, last_name),
|
|
personal_code = coalesce(p_personal_code, personal_code),
|
|
phone = coalesce(p_phone, phone),
|
|
city = coalesce(p_city, city),
|
|
has_consent_personal_data = coalesce(p_has_consent_personal_data,
|
|
has_consent_personal_data),
|
|
email = coalesce(p_email, email)
|
|
where id = p_uid;
|
|
end;$function$
|
|
;
|
|
|
|
grant
|
|
execute on function medreport.update_account(
|
|
p_name character varying,
|
|
p_last_name text,
|
|
p_personal_code text,
|
|
p_phone text,
|
|
p_city text,
|
|
p_has_consent_personal_data boolean,
|
|
p_uid uuid,
|
|
p_email character varying) to authenticated,
|
|
service_role;
|