pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix handling of opclauses in extended statistics
Date: Thu, 18 Jul 2019 09:30:28 +0000
Message-ID: <E1ho2k8-0004Fb-Cx@gemulon.postgresql.org> (raw)

Fix handling of opclauses in extended statistics

We expect opclauses to have exactly one Var and one Const, but the code
was checking the Const by calling is_pseudo_constant_clause() which is
incorrect - we need a proper constant.

Fixed by using plain IsA(x,Const) to check type of the node. We need to
do these checks in two places, so move it into a separate function that
can be called in both places.

Reported by Andreas Seltenreich, based on crash reported by sqlsmith.

Backpatch to v12, where this code was introduced.

Discussion: https://postgr.es/m/8736jdhbhc.fsf%40ansel.ydns.eu
Backpatch-to: 12

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/42276976a1437c88fb6176fc1a876fd79a139eb0

Modified Files
--------------
src/backend/statistics/extended_stats.c          | 76 ++++++++++++++++++++----
src/backend/statistics/mcv.c                     | 27 +++------
src/include/statistics/extended_stats_internal.h |  2 +
3 files changed, 73 insertions(+), 32 deletions(-)



view thread (2+ messages)

Message-ID: <E1ho2k8-0004Fb-Cx@gemulon.postgresql.org>
Permalink:  ../E1ho2k8-0004Fb-Cx@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ho2k8-0004Fb-Cx@gemulon.postgresql.org

 · 

reply

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-committers@postgresql.org
  Cc: tomas.vondra@postgresql.org
  Subject: Re: pgsql: Fix handling of opclauses in extended statistics
  In-Reply-To: <E1ho2k8-0004Fb-Cx@gemulon.postgresql.org>
  References: <E1ho2k8-0004Fb-Cx@gemulon.postgresql.org>

* 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