-- TRAP: FailedAssertion("!(!((((const Node*)(node))->type) == T_SubLink))", File: "clauses.c", Line: 440)
begin;

CREATE TABLE target (tid integer, balance integer);
INSERT INTO target VALUES (1, 10);
INSERT INTO target VALUES (2, 20);
INSERT INTO target VALUES (3, 30);
ALTER TABLE target ADD PRIMARY KEY (tid);

CREATE TABLE source (sid integer, delta integer);
INSERT INTO source VALUES (4, 40);
INSERT INTO source VALUES (2, 5);
INSERT INTO source VALUES (3, 20);

MERGE INTO public.target as target_0
USING public.target as sample_0
  left join public.target as ref_0
  on (pg_catalog.jsonb_build_object() = (select pg_catalog.jsonb_agg(tid) from public.target)
        )
ON target_0.balance = sample_0.tid 
WHEN MATCHED AND (cast(null as circle) ~ cast(null as circle)) 
    and (cast(null as float4) = cast(null as float8))
   THEN UPDATE  set 
    balance = target_0.tid;

rollback;
