On Wed, May 11, 2016 at 9:09 PM, David E. Wheeler <david@justatheory.com> wrote: > > On May 11, 2016, at 11:01 AM, Fabrízio de Royes Mello <fabriziomello@gmail.com> wrote: > > > I know... but you can do that just in case the current behaviour fail by cathing it with "begin...exception...", so you'll minimize the looking for process on catalog. > > Yeah, I guess. Honestly 90% of this issue would go away for me if there was a `json = json` operator. I know there are a couple different ways to interpret JSON equality, though. >
Yeah.. it's ugly but you can do something like that:
CREATE OR REPLACE FUNCTION json_equals_to_json(first JSON, second JSON) RETURNS boolean AS $$ BEGIN RETURN first::TEXT IS NOT DISTINCT FROM second::TEXT; END $$ LANGUAGE plpgsql IMMUTABLE;