problem with precendence order in JSONB merge operator

Поиск
Список
Период
Сортировка
От Peter Krauss
Тема problem with precendence order in JSONB merge operator
Дата
Msg-id CAHEREtuOz=_R+aoF+21T0NSmRrbrur7ZGo512jChXA_Ahg7ekw@mail.gmail.com
обсуждение исходный текст
Ответы Re: problem with precendence order in JSONB merge operator  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-hackers
Seems that parser not using precedence ideal order, and that casting obligation losts performance.
  
The first problem is self-evident in this example:
SELECT '{"x":1}'::jsonb || (('{"A":{"y":2}}'::jsonb)->'A')  -- it is ok, expected result with (x,y)

SELECT '{"x":1}'::jsonb || '{"A":{"y":2}}'::jsonb)->'A'    -- non-expected result (y).

Higher precedence most be for -> operator, that is like an object-oriented path operator, always higher than algebric ones.


Other problem is using this operation as SQL function,

  CREATE FUNCTION term_lib.junpack(jsonb,text) RETURNS JSONB AS $f$       SELECT ($1-$2)::JSONB || ($1->>$2)::JSONB;  $f$ LANGUAGE SQL IMMUTABLE;

without casting produce error. Perhaps will be "more friendly" without cast obligation, 

and it is a performance problem, the abusive use of castings losts performance.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Grzegorz Sampolski
Дата:
Сообщение: Re: pam auth - add rhost item
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: WIP: Access method extendability