Re: Does Type Have = Operator?
От | Fabrízio de Royes Mello |
---|---|
Тема | Re: Does Type Have = Operator? |
Дата | |
Msg-id | CAFcNs+oVXKGfYcXyy6TEU-0Ki8K+G-su54w6YkFdFdU1u+Ej=Q@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Does Type Have = Operator? ("David E. Wheeler" <david@justatheory.com>) |
Ответы |
Re: Does Type Have = Operator?
|
Список | pgsql-hackers |
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.
>
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;
CREATE OPERATOR = (
LEFTARG = json,
RIGHTARG = json,
PROCEDURE = json_equals_to_json
);
Regards,
--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Timbira: http://www.timbira.com.br
>> Blog: http://fabriziomello.github.io
>> Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello
>> Github: http://github.com/fabriziomello
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Timbira: http://www.timbira.com.br
>> Blog: http://fabriziomello.github.io
>> Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello
>> Github: http://github.com/fabriziomello
В списке pgsql-hackers по дате отправления: