Re: havingQual vs hasHavingQual buglets - Mailing list pgsql-hackers

From Richard Guo
Subject Re: havingQual vs hasHavingQual buglets
Date
Msg-id CAMbWs483p-h5caneOz+dfqOpH3W17MZQgCsrc6WcXyt-4vmvuA@mail.gmail.com
Whole thread Raw
In response to havingQual vs hasHavingQual buglets  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: havingQual vs hasHavingQual buglets
List pgsql-hackers

On Tue, Oct 18, 2022 at 5:37 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
I came across a couple of places in the planner that are checking
for nonempty havingQual; but since these bits run after
const-simplification of the HAVING clause, that produces the wrong
answer for a constant-true HAVING clause (which'll be folded to
empty).  Correct code is to check root->hasHavingQual instead.
 
+1. root->hasHavingQual is set before we do any expression
preprocessing. It should be the right one to check with.

Thanks
Richard

pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Allow WindowFuncs prosupport function to use more optimal WindowClause options
Next
From: Masahiko Sawada
Date:
Subject: Re: TRAP: FailedAssertion("prev_first_lsn < cur_txn->first_lsn", File: "reorderbuffer.c", Line: 927, PID: 568639)