only swap parts if a replacement is given

This commit is contained in:
Paul Trowbridge 2020-03-06 05:48:39 +00:00
parent 87d5dbceaf
commit 3d5cd9b2ff

View File

@ -6,6 +6,8 @@ target AS (SELECT $$swap_doc$$::jsonb swap)
FROM FROM
TARGET TARGET
LEFT JOIN LATERAL jsonb_to_recordset(target.swap->'rows') AS x(original text, sales numeric, replace text, fit text)ON TRUE LEFT JOIN LATERAL jsonb_to_recordset(target.swap->'rows') AS x(original text, sales numeric, replace text, fit text)ON TRUE
WHERE
COALESCE(x.replace,'') <> ''
) )
--select * from pl --select * from pl
,seg AS ( ,seg AS (