Re: Custom Operators Cannot be Found for Composite Type Values - Mailing list pgsql-hackers

From David E. Wheeler
Subject Re: Custom Operators Cannot be Found for Composite Type Values
Date
Msg-id 0D0EEF3A-7767-4206-9FFB-85C484F49C42@justatheory.com
Whole thread Raw
In response to Re: Custom Operators Cannot be Found for Composite Type Values  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
On Mar 8, 2012, at 11:27 AM, Andrew Dunstan wrote:

> Yeah. Note too that this is at best dubious:
>
>    CREATE OR REPLACE FUNCTION json_cmp(
>        json,
>        json
>    ) RETURNS INTEGER LANGUAGE SQL STRICT IMMUTABLE AS $$
>        SELECT bttextcmp($1::text, $2::text);
>    $$;
>
>
> Two pieces of JSON might well be textually different but semantically identical (e.g. by one having additional
non-semanticwhitespace). 

Yes. This is just for unit tests, and is fine for the moment. If I end up with abnormalities, I will likely rewrite
json_cmp()in Perl and use JSON::XS to do normalization. Not needed yet, though. 

Thanks,

David



pgsql-hackers by date:

Previous
From: "David E. Wheeler"
Date:
Subject: Re: Custom Operators Cannot be Found for Composite Type Values
Next
From: "David E. Wheeler"
Date:
Subject: Re: regress bug