pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: James Coleman <jtc331@gmail.com>
Cc: Tomas Vondra <tomas.vondra@enterprisedb.com>
Cc: Luc Vlaming <luc@swarm64.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Cc: Robert Haas <robertmhaas@gmail.com>
Subject: Re: "could not find pathkey item to sort" for TPC-DS queries 94-96
Date: Mon, 19 Apr 2021 18:09:51 -0400
Message-ID: <366787.1618870191@sss.pgh.pa.us> (raw)
In-Reply-To: <CAAaqYe_vcq4vjF7+B8PPwQ5HvMb-7pi0C8Kzb4o3vC_4k_x-KQ@mail.gmail.com>
References: <91f3ec99-85a4-fa55-ea74-33f85a5c651f@swarm64.com>
	<b386c655-ba5d-a1e2-9791-83b103f5a638@enterprisedb.com>
	<CAAaqYe_NU4hO9COoJdcXWqjtH=dGMknYdsSdJjZ=JOHPTea-Nw@mail.gmail.com>
	<CAAaqYe8hst0zS4FDc-gS++u=NRkdKYEn5-zi8FLjDp2+DELBdw@mail.gmail.com>
	<d34620b9-3585-553a-3b76-ef7151c16f0e@swarm64.com>
	<CAAaqYe90ASC2deAaVou6ev5ppXMGG_epWK+D5yeqpwxG3-OEzw@mail.gmail.com>
	<ffd9a157-9c7c-6efe-19e4-2af81a6eb220@enterprisedb.com>
	<355670.1618688385@sss.pgh.pa.us>
	<90179.1618766515@sss.pgh.pa.us>
	<CAAaqYe_vcq4vjF7+B8PPwQ5HvMb-7pi0C8Kzb4o3vC_4k_x-KQ@mail.gmail.com>

James Coleman <jtc331@gmail.com> writes:
> Two things I wonder:
> 1. Should we add tests for the relabel code path?

As far as that goes, the Relabel-stripping loops in
find_ec_member_matching_expr are already exercised in the core
regression tests (I didn't bother to discover exactly where, but
a quick coverage test run says that they're hit).  The ones in
exprlist_member_ignore_relabel are not iterated though.  On
reflection, the first loop stripping the input node is visibly
unreachable by the sole caller, since everything in the exprvars
list will be a Var, Aggref, WindowFunc, or PlaceHolderVar.  I'm
less sure about what is possible in the targetlist that we're
referencing, but it strikes me that ignoring relabel on that
side is probably functionally wrong: if we have say "f(textcol)"
as an expression to be sorted on, but what is in the tlist is
textcol::varchar or the like, I do not think setrefs.c will
consider that an acceptable match.  So now that's seeming like
an actual bug --- although the lack of field reports suggests
that it's unreachable, most likely because if we do have
"f(textcol)" as a sort candidate, we'll have made sure to emit
plain "textcol" from the source relation, regardless of whether
there might also be a reason to emit textcol::varchar.

Anyway I'm now inclined to remove that behavior from
find_computable_ec_member, and adjust comments accordingly.

> 2. It'd be nice not to have the IS_SRF_CALL duplicated, but that might
> add enough complexity that it's not worth it.

Yeah, I'd messed around with variants that put more smarts
into the bottom-level functions, and decided that it wasn't
a net improvement.

			regards, tom lane





view thread (29+ messages)  latest in thread

Message-ID: <366787.1618870191@sss.pgh.pa.us>
Permalink:  ../366787.1618870191@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/366787.1618870191@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, jtc331@gmail.com, tomas.vondra@enterprisedb.com, luc@swarm64.com, robertmhaas@gmail.com
  Subject: Re: "could not find pathkey item to sort" for TPC-DS queries 94-96
  In-Reply-To: <366787.1618870191@sss.pgh.pa.us>
  References: <91f3ec99-85a4-fa55-ea74-33f85a5c651f@swarm64.com> <b386c655-ba5d-a1e2-9791-83b103f5a638@enterprisedb.com> <CAAaqYe_NU4hO9COoJdcXWqjtH=dGMknYdsSdJjZ=JOHPTea-Nw@mail.gmail.com> <CAAaqYe8hst0zS4FDc-gS++u=NRkdKYEn5-zi8FLjDp2+DELBdw@mail.gmail.com> <d34620b9-3585-553a-3b76-ef7151c16f0e@swarm64.com> <CAAaqYe90ASC2deAaVou6ev5ppXMGG_epWK+D5yeqpwxG3-OEzw@mail.gmail.com> <ffd9a157-9c7c-6efe-19e4-2af81a6eb220@enterprisedb.com> <355670.1618688385@sss.pgh.pa.us> <90179.1618766515@sss.pgh.pa.us> <CAAaqYe_vcq4vjF7+B8PPwQ5HvMb-7pi0C8Kzb4o3vC_4k_x-KQ@mail.gmail.com> <366787.1618870191@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