Re: Proposal for JSONB functions for internal representation casting insted text-casting

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: Proposal for JSONB functions for internal representation casting insted text-casting
Дата
Msg-id CA+TgmobgzHyRif6K1kDk1SUdSc0KdM8DF-fARNmJSLGbOxvSUg@mail.gmail.com
обсуждение исходный текст
Ответ на Proposal for JSONB functions for internal representation casting insted text-casting  (Peter Krauss <ppkrauss@gmail.com>)
Ответы Re: Proposal for JSONB functions for internal representation casting insted text-casting  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
On Sun, Jan 3, 2016 at 3:24 PM, Peter Krauss <ppkrauss@gmail.com> wrote:
> The usefulness of  ->>  operator is indisputable, but even with boolean or
> numeric values, with good binary internal representation, it returns JSONB
> value as text data type.
>
> The simple (myJSONB->>'myField')::expectedType is not enough because:
>
> 1) there are no internal optimization,  need two-step casting, first
> bynary-to-text, them text-to-expectedType.
>
> 2) if expectedType is not the expected (in the associated jsonb_typeof),
> generates an error... The ideal "return NULL" convention is not easy to
> implement with usual casting.

Agreed, something like this would be useful.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Proposal: SET ROLE hook
Следующее
От: Robert Haas
Дата:
Сообщение: Re: Better detail logging for password auth failures