Hi all,
I am currently testing if xmax = 0 to achieve this however I understand this is not reliable.
An excerpt follows - I am performing bulk data maintenance, hence the insert into/select from. The "returning" clause would ideally reference something more reliable than xmax.
insert into test_table (test_id, test_code, test_name)
select test_code, test_name
from bulk_test_data
on conflict (test_code) do update
set test_name = test_name_in
where test_table.test_name is distinct from excluded.test_name
returning test_id, case when (xmax = 0)::boolean as inserted
Regards,
Roby.