Re: Optimization for updating foreign tables in Postgres FDW

From: Etsuro Fujita <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp>
To: Rushabh Lathia <rushabh(dot)lathia(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Noah Misch <noah(at)leadboat(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Thom Brown <thom(at)linux(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Shigeru Hanada <shigeru(dot)hanada(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Optimization for updating foreign tables in Postgres FDW
Date: 2016-04-11 02:30:31
Message-ID: 570B0C47.50408@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2016/04/08 22:21, Rushabh Lathia wrote:
> On Fri, Apr 8, 2016 at 6:28 PM, Robert Haas <robertmhaas(at)gmail(dot)com
> <mailto:robertmhaas(at)gmail(dot)com>> wrote:

> The comment just before the second hunk in the patch says:
>
> * We don't use a PG_TRY block here, so be careful not to
> throw error
> * without releasing the PGresult.
>
> But the patch adds a whole bunch of new things there that seem like
> they can error out, like CHECK_FOR_INTERRUPTS(), for example. Isn't
> that a problem?

> Basically we fetching the PGresult, after the newly added hunk, so there
> should not be any problem.
>
> But yes comment is definitely at wrong place.
>
> PFA patch with correction.

I agree with Rushabh. Thanks for updating the patch!

Another thing I'd like to propose to revise the patch is to call
pgfdw_report_error in the newly added hunk, with the clear argument set
to *false*. The PGresult argument is NULL there, so no need to release
the PGresult.

Attached is an updated patch.

Best regards,
Etsuro Fujita

Attachment Content-Type Size
pgfdw-direct-modify-v4.patch text/x-patch 3.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-04-11 02:47:30 Re: Weird irreproducible behaviors in plpython tests
Previous Message Andres Freund 2016-04-11 02:18:22 Re: Weird irreproducible behaviors in plpython tests