havingQual vs hasHavingQual buglets

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: havingQual vs hasHavingQual buglets
Date: 2022-10-17 21:37:23
Message-ID: 2503888.1666042643@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

These mistakes only affect cost estimates, and they're sufficiently
corner cases that it'd be hard even to devise a reliable test case
showing a different plan choice. So I'm not very excited about this,
and am thinking of committing only to HEAD.

regards, tom lane

Attachment Content-Type Size
fix-hasHavingQual-oversights.patch text/x-diff 1.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Erwin Brandstetter 2022-10-17 22:10:12 Re: Allow WindowFuncs prosupport function to use more optimal WindowClause options
Previous Message Robert Haas 2022-10-17 21:14:21 Re: problems with making relfilenodes 56-bits