From: Michael Paquier <michael@paquier.xyz>
To: shihao zhong <zhong950419@gmail.com>
Cc: Atisss hh <125atishprak@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org, Tom Lane <tgl@sss.pgh.pa.us>
Subject: Re: BUG #19849: queries fail after ANALYZE with expression stats on arrays
Date: Mon, 9 Nov 2026 14:48:00 +0900
Message-ID: <avFekPK2YMzo_l6V@paquier.xyz> (raw)
In-Reply-To: <CAGRkXqSbfQ4nbaf5jh4cxoEBZX86iLjoVhdCBqH0J_Osviskyg@mail.gmail.com>
References: <19849-38b8bd2fea807154@postgresql.org>
<CAGqfTtvt=d-aCEnVE1zRDMpUO9SyL3mAuCYzwdJodoNd0B5w8w@mail.gmail.com>
<CAGRkXqSbfQ4nbaf5jh4cxoEBZX86iLjoVhdCBqH0J_Osviskyg@mail.gmail.com>
On Mon, Nov 09, 2026 at 12:10:33AM -0500, shihao zhong wrote:
> Thanks for the report and the patch, Atish. I can reproduce it on
> master and 19rc1, and 18 works.
>
> 0001 is your fix plus the same change for stanumbers. Now
> serialize_expr_stats() matches update_attstats() again.
>
> 0002 adds a test to stats_ext with empty arrays and tsvectors.
>
> This came with 261f89a976b, so it should go to 19 too.
Hmm, yeah, that looks like an oversight in the serialization of the
expression stats, and we should map to a non-NULL check. I would not
call this error a expected:
ERROR: unexpected null value in cached tuple for catalog pg_statistic
column stavalues1
FWIW, I have been puzzled by this failure while looking a bit at the
surroundings of this code for a different bug, just today. when
dealing with empty arrays for MCEs:
https://www.postgresql.org/message-id/avFaBdhb4ONGhIjH%40paquier.xyz
And then noted that this thread already reported something..
Tom, any thoughts?
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: michael@paquier.xyz, zhong950419@gmail.com, 125atishprak@gmail.com, tgl@sss.pgh.pa.us
Subject: Re: BUG #19849: queries fail after ANALYZE with expression stats on arrays
In-Reply-To: <avFekPK2YMzo_l6V@paquier.xyz>
References: <19849-38b8bd2fea807154@postgresql.org> <CAGqfTtvt=d-aCEnVE1zRDMpUO9SyL3mAuCYzwdJodoNd0B5w8w@mail.gmail.com> <CAGRkXqSbfQ4nbaf5jh4cxoEBZX86iLjoVhdCBqH0J_Osviskyg@mail.gmail.com> <avFekPK2YMzo_l6V@paquier.xyz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox