Re: BUG #18077: PostgreSQL server subprocess crashed by a SELECT statement with WITH clause
Andrei Lepikhov <a.lepikhov@postgrespro.ru>
From: "Lepikhov Andrei" <a.lepikhov@postgrespro.ru>
To: "Richard Guo" <guofenglinux@gmail.com>
Cc: "Tom Lane" <tgl@sss.pgh.pa.us>, fuboat@outlook.com,
pgsql-bugs@lists.postgresql.org
Date: 2023-09-07T08:25:36Z
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.lepikhov@postgrespro.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
Commits
-
Track nesting depth correctly when drilling down into RECORD Vars.
- e0e492e5a928 17.0 landed
- d29812c0c6cd 12.17 landed
- c5b7f791dab9 13.13 landed
- ae13f8166dc3 14.10 landed
- a374f6c61681 11.22 landed
- 53630f12d39b 16.1 landed
- 2679a107a152 15.5 landed
-
Fix get_expr_result_type() to find field names for RECORD Consts.
- 8a15b4178c40 12.17 landed
- 59bc0dfe44a6 13.13 landed
- 479b99125dcc 11.22 landed
-
Allow extracting fields from a ROW() expression in more cases.
- ece1154f4c89 11.22 landed
- 2f02d4a2b9cb 12.17 landed