pgsql: Fix pg_mcv_list deserialization

From: Tomas Vondra <tomas(dot)vondra(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix pg_mcv_list deserialization
Date: 2019-04-15 22:03:21
Message-ID: E1hG9hB-0001rs-IY@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix pg_mcv_list deserialization

The memcpy() was copying type OIDs in the wrong direction, so the
deserialized MCV list always had them as 0. This is mostly harmless
except when printing the data in pg_mcv_list_items(), in which case
it reported

ERROR: cache lookup failed for type 0

Also added a simple regression test for pg_mcv_list_items() function,
printing a single-item MCV list.

Reported-By: Dean Rasheed
Discussion: https://postgr.es/m/CAEZATCX6T0iDTTZrqyec4Cd6b4yuL7euu4=rQRXaVBAVrUi1Cg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3824ca30d162611fdaade403d3aec449fecd0924

Modified Files
--------------
src/backend/statistics/mcv.c | 2 +-
src/test/regress/expected/stats_ext.out | 11 +++++++++++
src/test/regress/sql/stats_ext.sql | 8 ++++++++
3 files changed, 20 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2019-04-15 23:33:05 pgsql: Use [FLEXIBLE_ARRAY_MEMBER] not [1] in MultiSortSupportData.
Previous Message Tom Lane 2019-04-15 20:47:13 pgsql: Fix failure with textual partition hash keys.