pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andrei Lepikhov <lepihov@gmail.com>
Cc: Richard Guo <guofenglinux@gmail.com>
Cc: exclusion@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18652: Planner can not find pathkey item to sort for query with expression and expression index
Date: Sat, 12 Oct 2024 15:13:47 -0400
Message-ID: <3322031.1728760427@sss.pgh.pa.us> (raw)
In-Reply-To: <73d3a8bb-531d-4db3-be75-e9ba7001a3f3@gmail.com>
References: <18652-deaa782ebcca85d1@postgresql.org>
	<2527690.1728510183@sss.pgh.pa.us>
	<CAMbWs49Pcnm_cX=7azYY9d8+qRrOOKDjJDCa0KGRk9kWWMOz3A@mail.gmail.com>
	<40c8a5c2-0040-4fe6-ab11-6dca23353a07@gmail.com>
	<3001952.1728680364@sss.pgh.pa.us>
	<73d3a8bb-531d-4db3-be75-e9ba7001a3f3@gmail.com>

Andrei Lepikhov <lepihov@gmail.com> writes:
> On 12/10/2024 03:59, Tom Lane wrote:
>> I wonder whether we're doing more work here than we really need to.
>> If the underlying table t1 has columns i and j, and we have an EC
>> member that references t1.j while the tlist only mentions t1.i,
>> wouldn't it still work to add t1.j to the tlist?  So maybe groveling
>> through the tlist members is unnecessary and we only need to be
>> performing some kind of relation-level check on whether all the
>> required relations are included in the input.

> I'm not sure I understand this point. Do you mean something like 
> attached?

More or less, yeah, although passing the tlist rather than some
more-direct representation of the current relation's relids looks
weird once you think of it this way.  After thinking about this
for awhile though, I suspect it is only sure to work for appendrel
children (where an EC match should be guaranteed to exist, by
construction).  Maybe we could use this simplified approach if we
know we're considering an appendrel child, but I doubt it's worth
having two code paths.

			regards, tom lane





view thread (18+ messages)

Message-ID: <3322031.1728760427@sss.pgh.pa.us>
Permalink:  ../3322031.1728760427@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3322031.1728760427@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, lepihov@gmail.com, guofenglinux@gmail.com, exclusion@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18652: Planner can not find pathkey item to sort for query with expression and expression index
  In-Reply-To: <3322031.1728760427@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox