Re: Extended statistics is not working on Vars hidden under a RelabelType

From: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Extended statistics is not working on Vars hidden under a RelabelType
Date: 2017-10-12 13:43:47
Message-ID: CAKJS1f-89Yh-ZiaCK5YVEUu+TDNK058r3JAfL8N-dws_L84PEg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 13 October 2017 at 02:17, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
> I propose this slightly larger change.

hmm, this is not right. You're not checking that there's a Var below
the RelabelType.

I tried with:

explain select * from ab where (a||a)::varchar = '' and b = '';

and your code assumed the OpExpr was a Var.

The reason Tomas coded it the way it was coded is due to the fact that
there's already code that works exactly the same way in
clauselist_selectivity(). Personally, I don't particularly like that
code, but I'd rather not invent a new way to do the same thing.

--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2017-10-12 13:47:22 BLK_DONE state in XLogReadBufferForRedoExtended
Previous Message Alvaro Herrera 2017-10-12 13:17:21 Re: Extended statistics is not working on Vars hidden under a RelabelType