Re: havingQual vs hasHavingQual buglets

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: havingQual vs hasHavingQual buglets
Date: 2022-10-18 00:47:35
Message-ID: CAMbWs483p-h5caneOz+dfqOpH3W17MZQgCsrc6WcXyt-4vmvuA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Oct 18, 2022 at 5:37 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-hackers by date

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