Re: Does Type Have = Operator?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
Cc: fabriziomello(at)gmail(dot)com, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Does Type Have = Operator?
Date: 2016-05-12 19:02:34
Message-ID: 5609.1463079754@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"David E. Wheeler" <david(at)justatheory(dot)com> writes:
> Some might argue that it ought to compare JSON objects, effectively be the equivalent of ::jsonb = ::jsonb, rather than ::text = ::text. But as Andrew points out to me offlist, if that's what they want why aren't they using jsonb in the first place?

> So I think that, up to the introduction of JSONB, it was important not to side one way or the other and put a JSON = operator in core. But now what we have JSONB, perhaps it makes sense to finally take sides and intoduce JSON = that does plain text comparison. Thoughts?

Meh. Right now, if you want to compare values of type JSON, you have to
either cast them to text or to jsonb, and that effectively declares which
comparison semantics you want. I'm not sure that prejudging that is a
good thing for us to do, especially when the argument that text semantics
are what you would probably want is so weak.

Andrew mentions in the extension you pointed to that providing a default
comparison operator would enable people to do UNION, DISTINCT, etc on JSON
columns without thinking about it. I'm not convinced that "without
thinking about it" is a good thing here. But if we were going to enable
that, I'd feel better about making it default to jsonb semantics ...

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2016-05-12 19:10:12 Re: Perf Benchmarking and regression.
Previous Message Tom Lane 2016-05-12 18:53:32 Re: Use %u to print user mapping's umid and userid