Re: BUG #18077: PostgreSQL server subprocess crashed by a SELECT statement with WITH clause

From: "Lepikhov Andrei" <a(dot)lepikhov(at)postgrespro(dot)ru>
To: "Richard Guo" <guofenglinux(at)gmail(dot)com>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, fuboat(at)outlook(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18077: PostgreSQL server subprocess crashed by a SELECT statement with WITH clause
Date: 2023-09-07 08:25:36
Message-ID: 3933834e-b657-4ad1-bf4e-5f3fbba7ba14@app.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Sep 6, 2023, at 1:55 PM, Richard Guo wrote:
> On Wed, Sep 6, 2023 at 11:40 AM Lepikhov Andrei
> <a(dot)lepikhov(at)postgrespro(dot)ru> wrote:
>> Hi,
>>
>> I am writing here just because you change this specific part of code.
>> Designing a custom node I found the problem with CTE and Subqueries. The reproduction sample looks quite similar to yours:
>>
>> create view tt24v as
>> with cte as materialized (select r from (values(1,2),(3,4)) r)
>> select (r).column2 as col_a, (rr).column2 as col_b from
>> cte join (select rr from (values(1,7),(3,8)) rr limit 2) ss
>> on (r).column1 = (rr).column1;
>> explain (verbose, costs off) select * from tt24v;
>>
>> but fails with the error "failed to find plan for CTE ..." with a custom node over a JOIN.
>
> The error message indicates that something must have gone wrong. I
> don't know well enough about custom scan, but I cannot reproduce this
> error with your query. Am I missing something?
I invented a dummy extension "pg_extension" [1], commit 4199a0c, which adds CustomScan over the first non-parameterized HashJoin at the pathlist.
The example presented in my letter earlier causes the ERROR on CTE. Moreover, if you remove the word 'materialized', you will find the same error on Subquery.

[1] https://github.com/danolivo/pg_extension/tree/main

--
Regards,
Andrei Lepikhov

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message James Pang (chaolpan) 2023-09-07 08:46:29 RE: FW: query pg_stat_ssl hang 100%cpu
Previous Message Richard Guo 2023-09-07 07:51:29 Re: BUG #18091: Unexpected Result by enable_material