Kyotaro HORIGUCHI <horiguchi.kyot...@lab.ntt.co.jp> wrote: > I had the following error with the following query. > > =# explain select * from pg_stat_get_activity(NULL) a join log(100000.0) p on > a.pid = p.p; > ERROR: no relation entry for relid 2 >
I think that the problem is that RTE_VALUES is wrapped in a subquery by parser while RTE_FUNCTION is not. Thus some additional processing is done by pull_up_simple_subquery() for VALUES. What seems to make difference here is the call of flatten_join_alias_vars() on the query targetlist, although pull_up_simple_subquery() does it for other reasons. Actually the comment about flatten_join_alias_vars() in pull_up_simple_subquery() makes me think if it's o.k. that pull_up_simple_function() sets rvcontext.need_phvs=false regardless strictness of the function: I think PlaceHolderVar might be needed if the function is not strict. (In contrast, pull_up_simple_values() does not have to care because pull_up_simple_subquery() handles such cases when it's processing the owning subquery). -- Antonin Houska Cybertec Schönig & Schönig GmbH Gröhrmühlgasse 26, A-2700 Wiener Neustadt Web: https://www.cybertec-postgresql.com