Fix pg_mcv_list deserialization
authorTomas Vondra <tomas.vondra@postgresql.org>
Mon, 15 Apr 2019 22:01:39 +0000 (00:01 +0200)
committerTomas Vondra <tomas.vondra@postgresql.org>
Mon, 15 Apr 2019 22:01:39 +0000 (00:01 +0200)
commit3824ca30d162611fdaade403d3aec449fecd0924
treee0d283b730858a43c31ccce486b20cd1d916b0ac
parent4b40e44f07c727c7a82b291d3b60098dd99f3f64
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
src/backend/statistics/mcv.c
src/test/regress/expected/stats_ext.out
src/test/regress/sql/stats_ext.sql