Re: ERROR: wrong varnullingrels (b 3) (expected (b)) for Var 2/1
| От | Richard Guo |
|---|---|
| Тема | Re: ERROR: wrong varnullingrels (b 3) (expected (b)) for Var 2/1 |
| Дата | |
| Msg-id | CAMbWs4-krwk0Wbd6WdufMAupuou_Ua73ijQ4XQCr1Mb5BaVtKQ@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: ERROR: wrong varnullingrels (b 3) (expected (b)) for Var 2/1 (Tom Lane <tgl@sss.pgh.pa.us>) |
| Ответы |
Re: ERROR: wrong varnullingrels (b 3) (expected (b)) for Var 2/1
|
| Список | pgsql-hackers |
On Mon, Jun 12, 2023 at 10:02 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Richard Guo <guofenglinux@gmail.com> writes:
> Yeah, that makes sense. process_subquery_nestloop_params is a better
> place to do this adjustments. +1 to v2 patch.
Pushed, then.
Oh, wait ... It occurred to me that we may have this same issue with
Memoize cache keys. In get_memoize_path we collect the cache keys from
innerpath's ppi_clauses and innerrel's lateral_vars, and the latter may
contain nullingrel markers that need adjustment. As an example,
consider the query below
explain (costs off)
select * from onek t1
left join onek t2 on true
left join lateral
(select * from onek t3 where t3.two = t2.two offset 0) s
on t2.unique1 = 1;
ERROR: wrong varnullingrels (b 3) (expected (b)) for Var 2/3
Attached is a patch that does the same adjustments to innerrel's
lateral_vars before they are added to MemoizePath->param_exprs.
I was wondering if there are more places that need this kind of
adjustments. After some thoughts I believe the Memoize cache keys
should be the last one regarding adjustments to nestloop parameters.
AFAICS the lateral references in origin query would go to two places,
one is plan_params and the other is lateral_vars. And now we've handled
both of them.
Thanks
Richard
Memoize cache keys. In get_memoize_path we collect the cache keys from
innerpath's ppi_clauses and innerrel's lateral_vars, and the latter may
contain nullingrel markers that need adjustment. As an example,
consider the query below
explain (costs off)
select * from onek t1
left join onek t2 on true
left join lateral
(select * from onek t3 where t3.two = t2.two offset 0) s
on t2.unique1 = 1;
ERROR: wrong varnullingrels (b 3) (expected (b)) for Var 2/3
Attached is a patch that does the same adjustments to innerrel's
lateral_vars before they are added to MemoizePath->param_exprs.
I was wondering if there are more places that need this kind of
adjustments. After some thoughts I believe the Memoize cache keys
should be the last one regarding adjustments to nestloop parameters.
AFAICS the lateral references in origin query would go to two places,
one is plan_params and the other is lateral_vars. And now we've handled
both of them.
Thanks
Richard
Вложения
В списке pgsql-hackers по дате отправления: