Re: Assert failure in CTE inlining with view and correlated subquery

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Assert failure in CTE inlining with view and correlated subquery
Date: 2022-04-21 07:51:53
Message-ID: CAMbWs498tSxj0eiR13JvgYq=hPjwqG086_Fo8X34ESp4OQHDug@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Apr 21, 2022 at 5:33 AM Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
wrote:

>
> it seems there's something wrong with CTE inlining when there's a view
> containing a correlated subquery referencing the CTE.
>

BTW, seems view is not a necessary condition to reproduce this issue.
For instance:

create table t (a int, b int);

explain (costs off) select a from
(
with t_cte as (select a, b from t)
select
a,
(select b from t_cte where t_cte.a = t.a) AS t_sub
from t
) sub;

Thanks
Richard

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2022-04-21 07:56:23 Re: Checking pgwin32_is_junction() errors
Previous Message Richard Guo 2022-04-21 07:28:32 Re: Assert failure in CTE inlining with view and correlated subquery