I\'m updating a Postgres 8.4 database (from C# code) and the basic task is simple enough: either UPDATE an existing row or INSERT a new one if one doesn\'t exist yet. Normally I
INSERT INTO table_name(column_list) VALUES(value_list)
ON CONFLICT target action;
https://www.postgresqltutorial.com/postgresql-upsert/
Dummy example :
insert into user_profile (user_id, resident_card_no, last_name) values
(103, '14514367', 'joe_inserted' )
on conflict on constraint user_profile_pk do
update set resident_card_no = '14514367', last_name = 'joe_updated';