ДT
Size: a a a
ДT
VS
IS
ДМ
Error occurred during SQL query execution
Причина:
SQL Error [42883]: ERROR: function json_to_recordset(jsonb) does not exist
Подсказка: No function matches the given name and argument types. You might need to add explicit type casts.
Где: PL/pgSQL function insert_or_update(jsonb) line 3 at SQL statement
ДМ
ДМ
CREATE OR REPLACE FUNCTION public.insert_or_update(data jsonb)
returns void
LANGUAGE plpgsql
AS $function$
begin
insert into public.contacts
(
user_id,
phone_number,
country_code,
email,
contact_name,
company,job_title,
account_name,
contact_group,
created_at
)
select x.userId, x.phoneNumber, x.countryCode, x.contactName, x.company, x.jobTitle, x.accountName, x.contactGroup, x.createdAt
from json_to_recordset(data)
on conflict on constraint contacts_un do
update set
contact_name = new.contact_name,
company = new.company,
contact_group = new.contact_group,
email = new.email,
account_name = new.account_name,
job_title = new.job_title;
END;
$function$
ДМ
IS
ДМ
ДМ
G
NP
G
G
CREATE OR REPLACE FUNCTION public.insert_or_update(data jsonb)
returns void
LANGUAGE plpgsql
AS $function$
begin
insert into public.contacts
(
user_id,
phone_number,
country_code,
email,
contact_name,
company,job_title,
account_name,
contact_group,
created_at
)
select x.userId, x.phoneNumber, x.countryCode, x.contactName, x.company, x.jobTitle, x.accountName, x.contactGroup, x.createdAt
from json_to_recordset(data)
on conflict on constraint contacts_un do
update set
contact_name = new.contact_name,
company = new.company,
contact_group = new.contact_group,
email = new.email,
account_name = new.account_name,
job_title = new.job_title;
END;
$function$
G