From: Antonin Houska <ah@cybertec.at>
To: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
Cc: asp437@gmail.com
Cc: a.bykov@postgrespro.ru
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Optimze usage of immutable functions as relation
Date: Thu, 08 Nov 2018 14:57:45 +0100
Message-ID: <10981.1541685465@localhost> (raw)
In-Reply-To: <20181024.120245.134697149.horiguchi.kyotaro@lab.ntt.co.jp>
References: <20180906185109.661aaef0@asp437-ThinkPad-L380>
<153994199621.10161.17815885396545049364.pgcf@coridan.postgresql.org>
<CACdpekK1oDy7-_HnXOaREa_8HM2r-fsp8iv5e6p8aWOdGdK8Mg@mail.gmail.com>
<20181024.120245.134697149.horiguchi.kyotaro@lab.ntt.co.jp>
Kyotaro HORIGUCHI <horiguchi.kyotaro@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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: ah@cybertec.at, horiguchi.kyotaro@lab.ntt.co.jp, asp437@gmail.com, a.bykov@postgrespro.ru, pgsql-hackers@lists.postgresql.org
Subject: Re: Optimze usage of immutable functions as relation
In-Reply-To: <10981.1541685465@localhost>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox