On Tue, Jan 27, 2026 at 11:50 PM Michael Paquier <[email protected]> wrote:
> On Wed, Jan 28, 2026 at 01:34:12PM +0900, Michael Paquier wrote: > > Could you look at the array bound issue please? Let's use the > > attached as a base of work for now, this is what's standing now at the > > top of my dev branch for the review of the MCV patch. > > By the way, why not just removing entirely most_common_val_nulls from > the input arguments and rely on the values in most_common_vals to > determine which value is NULL? It seems useless to me to have > most_common_val_nulls knowing that we are relying already on > deconstruct_array_builtin() to determine if the input values are NULL > or not. That would also simplify the code a lot, especially in > statext_mcv_import() where we check that either the input from > most_common_val_nulls or the nulls array returned by > deconstruct_array_builtin() are NULL to decide if we should check the > input or not. And that would remove entirely the overread issue, > reducing the input blast. :) > The short answer overcaution. The longer answer is we ingest it because pg_mcv_list() returns it ( https://www.postgresql.org/docs/current/functions-statistics.html) and I assumed that it must be necessary for some corner-case input, otherwise why would pg_mcv_list() export it? In retrospect, its lack of presence in pg_stats view should have been a clue that we could get by without it. I'm happy to rip it out and submit another patchset.
