Re: Extract numeric filed in JSONB more effectively
От | Andy Fan |
---|---|
Тема | Re: Extract numeric filed in JSONB more effectively |
Дата | |
Msg-id | CAKU4AWrvguHRmjgSbSvmsBFeBAZdyXNNE94SnBYkYEmFF-KbYA@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Extract numeric filed in JSONB more effectively (jian he <jian.universality@gmail.com>) |
Ответы |
Re: Extract numeric filed in JSONB more effectively
|
Список | pgsql-hackers |
Hi:
can confirm the patch's jsonb_object_field_numeric is faster than
pg_catalog."numeric"(jsonb).
Thanks for the confirmation.
This function is not easy to find out...
select jsonb_numeric(jsonb'{"a":11}'->'a'); --fail
jsonb_numeric is a prosrc rather than a proname, that's why you
can't call them directly.
select * from pg_proc where proname = 'jsonb_numeric';
It is bound to "numeric"(jsonb) cast, so we can call it with
a->'a'::numeric.
select numeric('{"a":11}'->'a'); --fail.
select "numeric"('{"a":11}'::jsonb->'a'); --ok
select numeric('1'::int); -- failed.
select "numeric"('1'::int); -- ok.
select "numeric"('1'::int); -- ok.
--
Best Regards
Andy Fan
В списке pgsql-hackers по дате отправления: