LM
Size: a a a
LM
D
LM
В
R
ДМ
CREATE OR REPLACE FUNCTION public.insert_or_update(data jsonb)
returns void
LANGUAGE plpgsql
AS $FUNCTION$
begin
insert into
(
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) x
(
id int8,
ser_id int8,
phone_number varchar,
ountry_code varchar,
contact_name varchar,
email varchar,
company varchar,
ob_title varchar,
account_name varchar,
contact_group int4,
created_at timestamp
updated_times int8
)
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$
ДМ
ДМ
Unterminated dollar quote started at position 98 in SQL CREATE OR REPLACE FUNCTIONKK
Unterminated dollar quote started at position 98 in SQL CREATE OR REPLACE FUNCTIONAL
Unterminated dollar quote started at position 98 in SQL CREATE OR REPLACE FUNCTIONCREATE OR REPLACE FUNCTION public.insert_or_update(data jsonb)
returns void
LANGUAGE plpgsql
AS $FUNCTION$
begin
insert into qq
(
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) x
(
id int8,
ser_id int8,
phone_number varchar,
ountry_code varchar,
contact_name varchar,
email varchar,
company varchar,
ob_title varchar,
account_name varchar,
contact_group int4,
created_at timestamp,
updated_times int8
)
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$
AL
ДМ
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 jsonb_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$
ДМ
AL
ДМ
AL
ДМ
VV
IZ
idle in transaction? idle in transaction состоянии живут дольше часа).VY