ERROR: operator does not exist: json = json LINE 11: COALESCE(NULLIF( ^ HINT: No operator matches the given name and argument types. You might need to add explicit type casts. SQL state: 42883 Character: 306
Right, json doesn't implement equality. You will need to cast to and compare text values.