Обсуждение: [GENERAL] JSONB Overlap Operator.

Поиск
Список
Период
Сортировка

[GENERAL] JSONB Overlap Operator.

От
Eduardo Felipe
Дата:
Hi there!

In a project I was experimenting with replacing array columns with JSONB columns, to allow a greater flexibility of types.

One thing that I found missing is the "overlap" operator (&&).

JSONB includes all other operators from arrays, such as containment (@>, <@), comparison (>, >=, <, <=) and inclusion (?). The only one missing is the overlap operator (&&).

Does anyone know of a technical reason that operator was not included on JSONB?

Best regards,

Eduardo Felipe.
E3C Tecnologia


Re: [GENERAL] JSONB Overlap Operator.

От
Merlin Moncure
Дата:
On Fri, Mar 17, 2017 at 9:43 AM, Eduardo Felipe <edufelipe@e3c.com.br> wrote:
> Hi there!
>
> In a project I was experimenting with replacing array columns with JSONB
> columns, to allow a greater flexibility of types.
>
> One thing that I found missing is the "overlap" operator (&&).
>
> JSONB includes all other operators from arrays, such as containment (@>,
> <@), comparison (>, >=, <, <=) and inclusion (?). The only one missing is
> the overlap operator (&&).
>
> Does anyone know of a technical reason that operator was not included on
> JSONB?

I really miss hstore slice() (which is a function, not an operator,
but the distinction is is minor IMO) where you can pass array of keys
and get a smaller object back.  This would have to be redefined a bit
since there are new edge cases with jsonb vs hstore but it ought to be
reasonably worked out.

merlin