Why is JSONB field automatically cast as TEXT?
От | Ben Uphoff |
---|---|
Тема | Why is JSONB field automatically cast as TEXT? |
Дата | |
Msg-id | AE11EB59-2FAC-4BD6-ABE0-BE40D5131CE4@villagemd.com обсуждение исходный текст |
Ответы |
Re: Why is JSONB field automatically cast as TEXT?
|
Список | pgsql-general |
First post here at PostgreSQL; please forgive any etiquette mistakes…
I have a query that extracts a field from a JSONB column, e.g.:
SELECT (((mytable.ajsonbcolumn -> ‘somedata’) -> ‘nested’) ->> ‘first_name’) AS fname FROM mytable
When I save it into a view, PostgreSQL transforms it thusly:
SELECT (((mytable.ajsonbcolumn -> ‘somedata’::text) -> ‘nested’::text) ->> ‘first_name’::text) AS fname FROM mytable
(note the ::text casts).
Why does it do this? It seems unnecessary and pollutes my SQL with a ton of extra text.
Thanks for your thoughts. -Ben
В списке pgsql-general по дате отправления: