From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "David E(dot) Wheeler" <david(at)justatheory(dot)com>, pgsql-hackers Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Custom Operators Cannot be Found for Composite Type Values |
Date: | 2012-03-08 19:27:08 |
Message-ID: | 4F59080C.1060201@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 03/08/2012 02:16 PM, Tom Lane wrote:
> "David E. Wheeler"<david(at)justatheory(dot)com> writes:
>> CREATE OPERATOR CLASS json_ops
>> DEFAULT FOR TYPE JSON USING btree AS
>> OPERATOR 3 = (json, json),
>> FUNCTION 1 json_cmp(json, json);
>> This seems to work.
> Urk. You really ought to provide the whole opclass (all 5 operators).
> I'm not sure what will blow up if you leave it like that, but it won't
> be pretty.
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-semantic whitespace).
cheers
andrew
From | Date | Subject | |
---|---|---|---|
Next Message | David E. Wheeler | 2012-03-08 19:31:19 | Re: Custom Operators Cannot be Found for Composite Type Values |
Previous Message | Noah Misch | 2012-03-08 19:22:46 | Re: Collect frequency statistics for arrays |