Re: Bug in row_number() optimization

David Rowley <dgrowleyml@gmail.com>

From: David Rowley <dgrowleyml@gmail.com>
To: Richard Guo <guofenglinux@gmail.com>
Cc: Sergey Shinderuk <s.shinderuk@postgrespro.ru>, Tom Lane <tgl@sss.pgh.pa.us>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>, David Rowley <drowley@postgresql.org>
Date: 2022-12-05T04:39:37Z
Lists: pgsql-hackers

Attachments

On Thu, 1 Dec 2022 at 21:18, Richard Guo <guofenglinux@gmail.com> wrote:
>> +   if (!func_strict(opexpr->opfuncid))
>> +       return false;
>>
>> Should return true instead?
>
>
> Yeah, you're right.  This should be a thinko.

Yeah, oops. That's wrong.

I've adjusted that in the attached.

I'm keen to move along and push the fix for this bug.  If there are no
objections to the method in the attached and also adding the
restriction to limit the optimization to only working with strict
OpExprs, then I'm going to push this, likely about 24 hours from now.

David

Commits

  1. Fix 32-bit build dangling pointer issue in WindowAgg

  2. Teach planner and executor about monotonic window funcs