Re: Bug in ExecModifyTable function and trigger issues for foreign tables

Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>

From: Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>, Ildus Kurbangaliev <i.kurbangaliev@postgrespro.ru>, Dilip Kumar <dilipbalaut@gmail.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>, Robert Haas <robertmhaas@gmail.com>
Date: 2017-07-20T02:21:57Z
Lists: pgsql-hackers
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



Commits

  1. Fix creation of resjunk tlist entries for inherited mixed UPDATE/DELETE.