pgsql: Skip system attributes when applying mvdistinct stats - Mailing list pgsql-committers

From Tomas Vondra
Subject pgsql: Skip system attributes when applying mvdistinct stats
Date
Msg-id E1iVmyt-0002bd-R2@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Skip system attributes when applying mvdistinct stats

When estimating number of distinct groups, we failed to ignore system
attributes when matching the group expressions to mvdistinct stats,
causing failures like

  ERROR: negative bitmapset member not allowed

Fix that by simply skipping anything that is not a regular attribute.
Backpatch to PostgreSQL 10, where the extended stats were introduced.

Bug: #16111
Reported-by: Tuomas Leikola
Author: Tomas Vondra
Backpatch-through: 10
Discussion: https://postgr.es/m/16111-687799584c3a7e73@postgresql.org

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/25a9ff6cadbb2099a5f53876d9e29f35a080df43

Modified Files
--------------
src/backend/utils/adt/selfuncs.c        | 19 ++++++++++++++-----
src/test/regress/expected/stats_ext.out | 12 ++++++++++++
src/test/regress/sql/stats_ext.sql      |  4 ++++
3 files changed, 30 insertions(+), 5 deletions(-)


pgsql-committers by date:

Previous
From: Tomas Vondra
Date:
Subject: pgsql: Skip system attributes when applying mvdistinct stats
Next
From: Tomas Vondra
Date:
Subject: pgsql: Skip system attributes when applying mvdistinct stats