Re: Cache lookup error when using jsonb, json_build_object and a WITH clause

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Cache lookup error when using jsonb, json_build_object and a WITH clause
Дата
Msg-id 8422.1399640953@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Cache lookup error when using jsonb, json_build_object and a WITH clause  (Michael Paquier <michael.paquier@gmail.com>)
Список pgsql-hackers
Michael Paquier <michael.paquier@gmail.com> writes:
> I found the following error when playing with jsonb and json_build_object:
> =# with jsonb_data as (select * from jsonb_each('{"aa" :
> "po"}'::jsonb)) select json_build_object(key,value) from jsonb_data;
> ERROR:  XX000: cache lookup failed for type 2147483650
> LOCATION:  lookup_type_cache, typcache.c:193

The immediate problem seems to be that add_json() did not get taught
that jsonb is of TYPCATEGORY_JSON; somebody missed updating that copy
of logic that's been copied and pasted several times too many, IMNSHO.

However, now that I look at this code, it seems like it's got more
problems than that:

* it will be fooled utterly by domains over types it's interested in.

* there is nothing stopping somebody from making user-defined types
with category 'j' or 'c', which will confuse it even more.
        regards, tom lane



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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: New pg_lsn type doesn't have hash/btree opclasses
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Cache lookup error when using jsonb, json_build_object and a WITH clause