Re: BUG #18652: Planner can not find pathkey item to sort for query with expression and expression index

From: Andrei Lepikhov <lepihov(at)gmail(dot)com>
To: Richard Guo <guofenglinux(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: exclusion(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18652: Planner can not find pathkey item to sort for query with expression and expression index
Date: 2024-10-11 04:25:47
Message-ID: 40c8a5c2-0040-4fe6-ab11-6dca23353a07@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 10/10/24 10:52, Richard Guo wrote:
> On Thu, Oct 10, 2024 at 5:43 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> It looks like we are generating a Path tree in which one of the
>> inputs to a MergeAppend is a plain unsorted seqscan, which'd
>> be all right except it doesn't expose the required sort value
>> in its targetlist.
> I think this is because find_computable_ec_member() only tries to
> match Vars. Maybe we should teach it to also match OpExprs?
Why not look if some entry of the TargetList contains the var? Something
like attached?
If I understand correctly, MergeAppend will still add a resjunk column
and Sort according to the column.

--
regards, Andrei Lepikhov

Attachment Content-Type Size
probe.patch text/x-patch 727 bytes

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alena Rybakina 2024-10-11 08:02:31 Re: BUG #18652: Planner can not find pathkey item to sort for query with expression and expression index
Previous Message Andrei Lepikhov 2024-10-11 02:43:52 Re: BUG #18652: Planner can not find pathkey item to sort for query with expression and expression index