Consider this snippet:
create table tbl_1(name text); create table tbl_2(name text); create function my_insert(_name text) returns text language sql as $$ insert into tbl_2(name) values (_name); select _name; $$; explain analyse with x as (select name from tbl_1) ,y as (select my_insert(x.name) from x) select 0 ;
Result (cost=12.72..12.72 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1) CTE x -> Seq Scan on tbl_1 (cost=0.00..12.72 rows=1360 width=32) (never executed) Planning Time: 0.053 ms Execution Time: 0.013 ms
Now I can understand why the clause
x isn't being executed (and also
y of course), but the plan doesn't mention anything about what happened to clause
This leads me to suspect that the query parser is emitting a query that doesn't contain the clause
How can I confirm this? How can I see what the parser is emitting here? Alternatively, how can see what query the planner evaluated?