A small example to reproduce this problem.
select bitemporal_internal.ll_create_bitemporal_table(
'common', 'person', $$id int not null,
name text, phone_number int$$, $$id$$
);
select
bitemporal_internal.ll_bitemporal_insert(
'common.person',
$$id,
name,
phone_number$$,
$$2,
'Joel Victor',
0123456789$$,
temporal_relationships.timeperiod(now(), 'infinity'),
temporal_relationships.timeperiod(now(), 'infinity')
);
begin;
select
bitemporal_internal.ll_bitemporal_update(
'common', 'person',
$$name,phone_number$$,
$$'Joel S. Victor',0123456789$$,
$$id$$,$$ 2$$,
temporal_relationships.timeperiod(now(), 'infinity'),
temporal_relationships.timeperiod(now(), 'infinity')
);
-- this fails
select
bitemporal_internal.ll_bitemporal_correction_select (
'common.person'::text,
$$name,phone_number$$::text,
$$'Joel S V',0123456789$$::text,
$$id = '2'$$::text,
now(),
now()
);
-- this also fails
select
bitemporal_internal.ll_bitemporal_correction_select (
'common.person'::text,
$$name,phone_number$$::text,
$$'Joel S V',0123456789$$::text,
$$id = '2'$$::text,
now(),
clock_timestamp()
);
-- this works
select
bitemporal_internal.ll_bitemporal_correction (
'common'::text,'person'::text,
$$name,phone_number$$::text,
$$'Joel S V',0123456789$$::text,
$$id$$::text,
$$2$$::text,
temporal_relationships.timeperiod(now(), 'infinity'),
now()
);
abort;
SQL Error [23P01]: ERROR: conflicting key value violates exclusion constraint "person_id_assert_eff_excl"
Detail: Key (id, asserted, effective)=(2, ["2022-08-23 16:22:25.25041+05:30",infinity), ["2022-08-23 16:22:23.056263+05:30",infinity)) conflicts with existing key (id, asserted, effective)=(2, ["2022-08-23 16:22:25.25041+05:30",infinity), ["2022-08-23 16:22:23.056263+05:30","2022-08-23 16:22:25.25041+05:30")).
Where: SQL statement "INSERT INTO common.person ( id,name,phone_number, effective, asserted )
SELECT id,name,phone_number ,effective, temporal_relationships.timeperiod_range(now(),
'infinity', '[)')
FROM common.person WHERE id = '2' AND '2022-08-23 16:22:25.25041+05:30'::timestamptz <@ effective
AND upper(asserted)= '2022-08-23 16:22:25.25041+05:30'
"
PL/pgSQL function bitemporal_internal.ll_bitemporal_correction_select(text,text,text,text,time_endpoint,time_endpoint) line 31 at EXECUTE