pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Cc: Andreas Seltenreich <seltenreich@gmx.de>
Cc: pgsql-hackers@lists.postgresql.org, Tomas Vondra <tomas.vondra@postgresql.org>
Subject: Re: [sqlsmith] Crash in mcv_get_match_bitmap
Date: Wed, 10 Jul 2019 17:45:24 -0400
Message-ID: <17042.1562795124@sss.pgh.pa.us> (raw)
In-Reply-To: <20190710212609.5mrl7hltbozoxpq7@development>
References: <8736jdhbhc.fsf@ansel.ydns.eu>
	<15097.1562792274@sss.pgh.pa.us>
	<20190710212609.5mrl7hltbozoxpq7@development>

Tomas Vondra <tomas.vondra@2ndquadrant.com> writes:
> Yeah, that's a bug. Will fix (not sure how yet).

You could do worse than replace this:

        ok = (NumRelids(clause) == 1) &&
            (is_pseudo_constant_clause(lsecond(expr->args)) ||
             (varonleft = false,
              is_pseudo_constant_clause(linitial(expr->args))));

with something like

	if (IsA(linitial(expr->args), Var) &&
	    IsA(lsecond(expr->args), Const))
	   ok = true, varonleft = true;
	else if (IsA(linitial(expr->args), Const) &&
	         IsA(lsecond(expr->args), Var))
	   ok = true, varonleft = false;

Or possibly get rid of varonleft as such, and merge extraction of the
"var" and "cst" variables into this test.

BTW, I bet passing a unary-argument OpExpr also makes this code
unhappy.

			regards, tom lane





view thread (19+ messages)  latest in thread

Message-ID: <17042.1562795124@sss.pgh.pa.us>
Permalink:  ../17042.1562795124@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/17042.1562795124@sss.pgh.pa.us

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, tomas.vondra@2ndquadrant.com, seltenreich@gmx.de, tomas.vondra@postgresql.org
  Subject: Re: [sqlsmith] Crash in mcv_get_match_bitmap
  In-Reply-To: <17042.1562795124@sss.pgh.pa.us>

* 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