From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | James Coleman <jtc331(at)gmail(dot)com> |
Cc: | Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, Luc Vlaming <luc(at)swarm64(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com> |
Subject: | Re: "could not find pathkey item to sort" for TPC-DS queries 94-96 |
Date: | 2021-04-19 22:09:51 |
Message-ID: | 366787.1618870191@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
James Coleman <jtc331(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Alexey Kondratov | 2021-04-19 22:22:41 | Free port choosing freezes when PostgresNode::use_tcp is used on BSD systems |
Previous Message | Tom Lane | 2021-04-19 21:42:04 | Re: "could not find pathkey item to sort" for TPC-DS queries 94-96 |