Re: Extract numeric filed in JSONB more effectively

Поиск
Список
Период
Сортировка
От Matthias van de Meent
Тема Re: Extract numeric filed in JSONB more effectively
Дата
Msg-id CAEze2WgCRNDETn8hFzSx55YQPQgiemzLYx71r7GT48OJ3mZv-g@mail.gmail.com
обсуждение исходный текст
Ответ на Extract numeric filed in JSONB more effectively  (Andy Fan <zhihui.fan1213@gmail.com>)
Ответы Re: Extract numeric filed in JSONB more effectively  (Andy Fan <zhihui.fan1213@gmail.com>)
Список pgsql-hackers
On Tue, 1 Aug 2023 at 06:39, Andy Fan <zhihui.fan1213@gmail.com> wrote:
>
> Hi:
>
> Currently if we want to extract a numeric field in jsonb, we need to use
> the following expression:  cast (a->>'a' as numeric). It will turn a numeric
> to text first and then turn the text to numeric again.

Why wouldn't you use cast(a->'a' as numeric), or ((a->'a')::numeric)?
We have a cast from jsonb to numeric (jsonb_numeric in jsonb.c) that
does not require this additional (de)serialization through text.

Kind regards,

Matthias van de Meent
Neon (https://neon.tech)



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

Предыдущее
От: "Hayato Kuroda (Fujitsu)"
Дата:
Сообщение: RE: Fix compilation warnings when CFLAGS -Og is specified
Следующее
От: shveta malik
Дата:
Сообщение: Re: Synchronizing slots from primary to standby