Re: jsonb subscript operator returns null when key is fetched from table

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: jsonb subscript operator returns null when key is fetched from table
Дата
Msg-id 2035559.1670872161@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: jsonb subscript operator returns null when key is fetched from table  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-bugs
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> Someone more experienced than I will need to actually do the debugging work
> though; hoping this reply will be seen by one of them.

Meh.  Somebody was cavalier about detoasting the subscript:

            jbvp = getKeyJsonValueFromContainer(container,
                                                VARDATA(path[i]),
                                                VARSIZE(path[i]) - VARHDRSZ,
                                                NULL);

Neither VARDATA nor VARSIZE are valid to apply to an arbitrary datum.
Apparently, nobody has ever tested this with a subscript value fetched
straight from disk :-(.  The given example accidentally works with
a NOT MATERIALIZED CTE because the whole thing gets stepwise folded
to constants.  Likewise, the expression with || accidentally works
because concatenation always yields a non-toasted result.

            regards, tom lane



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

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: jsonb subscript operator returns null when key is fetched from table
Следующее
От: David Rowley
Дата:
Сообщение: Re: BUG #17710: Slow queries (100% CPU) after auto-vacuum