Re: [sqlsmith] Crash in mcv_get_match_bitmap

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
Cc: Andreas Seltenreich <seltenreich(at)gmx(dot)de>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Tomas Vondra <tomas(dot)vondra(at)postgresql(dot)org>
Subject: Re: [sqlsmith] Crash in mcv_get_match_bitmap
Date: 2019-07-10 21:45:24
Message-ID: 17042.1562795124@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2019-07-10 21:59:04 Re: [sqlsmith] Crash in mcv_get_match_bitmap
Previous Message Joe Conway 2019-07-10 21:43:58 Re: [Proposal] Table-level Transparent Data Encryption (TDE) and Key Management Service (KMS)