Re: Multivariate MCV lists -- pg_mcv_list_items() seems to be broken

From: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Multivariate MCV lists -- pg_mcv_list_items() seems to be broken
Date: 2019-04-15 16:55:33
Message-ID: 20190415165533.25gotopt5yffwdaj@development
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Apr 15, 2019 at 12:26:02PM -0400, Tom Lane wrote:
>Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> writes:
>> SELECT pg_mcv_list_items(stxmcv) from pg_statistic_ext WHERE stxname = 'foo_s';
>> which fails with
>> ERROR: cache lookup failed for type 0
>
>> That definitely used to work, so I'm guessing it got broken by the
>> recent reworking of the serialisation code, but I've not looked into
>> it.
>
>Yeah, looks like sloppy thinking about whether or not the types array
>participates in maxalign-forcing?
>

Actually, no. It seems aligned just fine, AFAICS. The bug a bit more
embarassing - the deserialization does

memcpy(ptr, mcvlist->types, sizeof(Oid) * ndims);

while it should be doing

memcpy(mcvlist->types, ptr, sizeof(Oid) * ndims);

Will fix.

cheers

--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2019-04-15 17:00:52 Re: plpgsql - execute - cannot use a reference to record field
Previous Message Bruce Momjian 2019-04-15 16:48:57 Re: block-level incremental backup