On 2017/07/19 23:36, Tom Lane wrote:
> Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp> writes:
>> * Modified rewrite_targetlist(), which is a new function added to
>> preptlist.c, so that we do const-simplification to junk TLEs that
>> AddForeignUpdateTargets() added, as that API allows the FDW to add junk
>> TLEs containing non-Var expressions to the query's targetlist.
>
> This does not seem like a good idea to me. eval_const_expressions is not
> a cheap thing, and for most use-cases those cycles will be wasted, and it
> has never been the responsibility of preprocess_targetlist to do this sort
> of thing.
Hm, I added that const-simplification to that function so that the
existing FDWs that append junk TLEs that need const-simplification,
which I don't know really exist, would work well for this fix, without
any changes, but I agree on that point.
> Please put the responsibility of doing const-expression simplification
> in these cases somewhere closer to where the problem is being created.
It would be reasonable that it's the FDW's responsibility to do that
const-simplification if necessary?
Best regards,
Etsuro Fujita