Re: FDW oddity - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: FDW oddity
Date
Msg-id 5529AE88.3010801@dunslane.net
Whole thread Raw
In response to Re: FDW oddity  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: FDW oddity
Re: FDW oddity
List pgsql-hackers
On 04/11/2015 05:10 PM, Tom Lane wrote:
> Andrew Dunstan <andrew@dunslane.net> writes:
>> I have just noticed something slightly odd. The traces (obtained by
>> setting client_min_messages to debug1) from the blackhole FDW show that
>> the handler function is called each time an INSERT is performed. This is
>> not the case for SELECT, UPDATE or DELETE. It looks at first glance like
>> a buglet. Can anyone suggest why this should be so?
> What do you mean by "the handler function", and for that matter what do
> you define as "each time"?  The ExecForeignInsert method certainly ought
> to be called once per row inserted, but the same is true of
> ExecForeignUpdate and ExecForeignDelete.  The setup methods such as
> BeginForeignModify should only be called once per query though.


I mean this function:
   Datum   blackhole_fdw_handler(PG_FUNCTION_ARGS)   {        FdwRoutine *fdwroutine = makeNode(FdwRoutine);
        elog(DEBUG1,"entering function %s",__func__);
        /* assign the handlers for the FDW */
     ...   }

And it is called at the beginning of every INSERT statement, before 
blackholePlanForeignModify() is called

cheers

andrew



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: improving speed of make check-world
Next
From: Petr Jelinek
Date:
Subject: Re: Replication identifiers, take 4