pgsql: Fix deserialization of pg_mcv_list values

Поиск
Список
Период
Сортировка
От Tomas Vondra
Тема pgsql: Fix deserialization of pg_mcv_list values
Дата
Msg-id E1h9abr-0008DR-J5@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix deserialization of pg_mcv_list values

There were multiple issues in deserialization of pg_mcv_list values.

Firstly, the data is loaded from syscache, but the deserialization was
performed after ReleaseSysCache(), at which point the data might have
already disappeared.  Fixed by moving the calls in statext_mcv_load,
and using the same NULL-handling code as existing stats.

Secondly, the deserialized representation used pointers into the
serialized representation.  But that is also unsafe, because the data
may disappear at any time.  Fixed by reworking and simplifying the
deserialization code to always copy all the data.

And thirdly, when deserializing values for types passed by value, the
code simply did memcpy(d,s,typlen) which however does not work on
bigendian machines.  Fixed by using fetch_att/store_att_byval.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/62bf0fb35cb370e9650981ff0333d198e955bd54

Modified Files
--------------
src/backend/statistics/mcv.c        | 436 +++++++++++++++++-------------------
src/include/statistics/statistics.h |   2 +-
2 files changed, 207 insertions(+), 231 deletions(-)


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

Предыдущее
От: Tomas Vondra
Дата:
Сообщение: Re: pgsql: Add support for multivariate MCV lists
Следующее
От: Tomas Vondra
Дата:
Сообщение: Re: pgsql: Add support for multivariate MCV lists