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