Re: Calling json_* functions with JSONB data

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Calling json_* functions with JSONB data
Дата
Msg-id CAKFQuwZGOzxbc2pQh1WaaD9HQuDs0hHVUQwtiXoT=YmZWWZcRA@mail.gmail.com
обсуждение исходный текст
Ответ на Calling json_* functions with JSONB data  (Peter van Hardenberg <pvh@pvh.ca>)
Ответы Re: Calling json_* functions with JSONB data  (Ryan Pedela <rpedela@datalanche.com>)
Список pgsql-hackers
On Mon, May 23, 2016 at 12:55 PM, Peter van Hardenberg <pvh@pvh.ca> wrote:
Hi there,

I noticed it was very easy to accidentally call the json_* form of JSON manipulation functions with jsonb data as input. This is pretty sub-optimal, since it involves rendering the jsonb then reparsing it and calling the json_* form of the function.

Fortunately, this seems quite easy to resolve by taking advantage of our ability to add json_*(jsonb) form of the functions.

I talked this over with Andrew who had no objections and suggested I float it on the list before writing a patch. Looks pretty straightforward, just a few new data rows in pg_proc.h.

Anyone have any concerns or suggestions?


Please provide an example of what you are talking about.

SELECT json_array_length('[1,2]'::jsonb)
ERROR: function json_array_length(jsonb) does not exist

-- The function name is "jsonb_array_length"; and there is no implicit cast between the two.

David J.

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Changed SRF in targetlist handling
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Parallel safety tagging of extension functions