Re: [HACKERS] Interesting behaviour ! - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] Interesting behaviour !
Date
Msg-id 25922.931969072@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] Interesting behaviour !  (Constantin Teodorescu <teo@flex.ro>)
Responses Re: [HACKERS] Interesting behaviour !
Re: [HACKERS] Interesting behaviour !
List pgsql-hackers
Constantin Teodorescu <teo@flex.ro> writes:
> Bruce Momjian wrote:
>> I thought we had this fixed in 6.5.  Is that what you are using?

> Yes!

It's not fixed, obviously.  We talked about the issue a while back,
but it isn't 100% clear what the most reasonable fix is.  Just making
the parser label small constants as int2 rather than int4 is no
answer; that'll only move the problem over to int4 tables :-(.

I have not looked closely at the parse trees produced for this sort
of thing, but if we are lucky they come out likevar int2eq (int4toint2(int4constant))
in which case the constant-subexpression-folding pass that I want to
add would solve the problem by reducing the righthand side to a simple
constant.

But it's more likely that the parser is producingint2toint4(var) int4eq int4constant
in which case it would take some actual intelligence to decide that this
could and should be converted to the other form.  I'd still be inclined
to tackle the issue in a post-rewriter, pre-planner pass over the tree.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Thomas Lockhart
Date:
Subject: Re: [HACKERS] Counting bool flags in a complex query
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] MAX Query length