pgsql: Fix handling of clauses incompatible with extended statistics

From: Tomas Vondra <tomas(dot)vondra(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix handling of clauses incompatible with extended statistics
Date: 2021-04-06 14:56:46
Message-ID: E1lTn8I-0007GC-IR@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix handling of clauses incompatible with extended statistics

Handling of incompatible clauses while applying extended statistics was
a bit confused - while handling a mix of compatible and incompatible
clauses it sometimes incorrectly treated the incompatible clauses as
compatible, resulting in a crash.

Fixed by reworking the code applying the selected statistics object to
make it easier to understand, and adding a proper compatibility check.

Reported-by: David Rowley
Discussion: https://postgr.es/m/CAApHDvpYT10-nkSp8xXe-nbO3jmoaRyRFHbzh-RWMfAJynqgpQ%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/518442c7f334f3b05ea28b7ef50f1b551cfcc23e

Modified Files
--------------
src/backend/statistics/extended_stats.c | 86 ++++++++++++++++++++++-----------
src/backend/statistics/mcv.c | 4 ++
src/test/regress/expected/stats_ext.out | 19 ++++++++
src/test/regress/sql/stats_ext.sql | 19 ++++++++
4 files changed, 100 insertions(+), 28 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tomas Vondra 2021-04-06 14:59:38 Re: pgsql: Extended statistics on expressions
Previous Message Peter Geoghegan 2021-04-06 14:50:29 pgsql: Refactor lazy_scan_heap() loop.