Re: BUG #17700: An assert failed in prepjointree.c

Daniel Gustafsson <daniel@yesql.se>

From: Daniel Gustafsson <daniel@yesql.se>
To: xinwen@stu.scu.edu.cn, pgsql-bugs@lists.postgresql.org
Date: 2022-11-28T12:32:45Z
Lists: pgsql-bugs
> On 28 Nov 2022, at 10:09, PG Bug reporting form <noreply@postgresql.org> wrote:

> When executing the following query:
> 
> WITH table3 ( column34 ) AS NOT MATERIALIZED ( SELECT 1 ) SELECT 1 FROM (
> SELECT 1 FROM table3 WHERE column34 = ANY ( SELECT alias4 . column34 FROM
> table3 FULL JOIN table3 AS alias4 ON TRUE )) AS alias5 ;

The full join on the rhs of the semi join creates a PlaceHolderVar due to
table3 not being materialized. A slightly shorter repro is:

with table3 as not materialized (
  select 1 as column34
)
select 1 from table3
where column34 in (
  select alias4.column34 from table3
    full join table3 as alias4 on true
);

--
Daniel Gustafsson		https://vmware.com/




Commits

  1. Remove bogus Assert and dead code in remove_useless_results_recurse().