INSERT INTO Fan (oid, campaigns, facts) VALUES (189,'{"campaign-id": "12345"}','{"attended": false}') ON CONFLICT (oid) DO UPDATE SET campaigns = EXCLUDED.campaigns, CASE WHEN fan.facts is NULL THEN facts = EXCLUDED.facts ELSE facts = fan.facts || EXCLUDED.facts END RETURNING *;
--
Melvin Davidson I reserve the right to fantasize. Whether or not you wish to share my fantasy is entirely up to you.