path->param_info only set for lateral?

Поиск
Список
Период
Сортировка
От James Coleman
Тема path->param_info only set for lateral?
Дата
Msg-id CAAaqYe_A4khvSSvDOPp8VBEFm3NODM9D_rVGsAs1h-dRutWN5g@mail.gmail.com
обсуждение исходный текст
Ответы Re: path->param_info only set for lateral?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hello,

Over in "Parallelize correlated subqueries that execute within each
worker" [1} Richard Guo found a bug in the current version of my patch
in that thread. While debugging that issue I've been wondering why
Path's param_info field seems to be NULL unless there is a LATERAL
reference even though there may be non-lateral outer params
referenced.

Consider the query:
select * from pg_description t1 where objoid in
    (select objoid from pg_description t2 where t2.description =
t1.description);

The subquery's rel has a baserestrictinfo containing an OpExpr
comparing a Var (t2.description) to a Param of type PARAM_EXEC
(t1.description). But the generated SeqScan path doesn't have its
param_info field set, which means PATH_REQ_OUTER returns NULL also
despite there being an obvious param referencing a required outer
relid. Looking at create_seqscan_path we see that param_info is
initialized with:

get_baserel_parampathinfo(root, rel, required_outer)

where required_outer is passed in from set_plain_rel_pathlist as
rel->lateral_relids. And get_baserel_parampathinfo always returns NULL
if required_outer is empty, so obviously with this query (no lateral
reference) we're not going to get any ParamPathInfo added to the path
or the rel.

Is there a reason why we don't track the required relids providing the
PARAM_EXEC params in this case?

Thanks,
James Coleman

1: https://www.postgresql.org/message-id/CAMbWs4_evjcMzN8Gw78bHfhfo2FKJThqhEjRJRmoMZx%3DNXcJ7w%40mail.gmail.com



В списке pgsql-hackers по дате отправления:

Предыдущее
От: torikoshia
Дата:
Сообщение: Re: Allow pg_archivecleanup to remove backup history files
Следующее
От: jian he
Дата:
Сообщение: Re: Deleting prepared statements from libpq.