|From:||Etsuro Fujita <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp>|
|To:||Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Noah Misch <noah(at)leadboat(dot)com>|
|Cc:||Robert Haas <robertmhaas(at)gmail(dot)com>, Rushabh Lathia <rushabh(dot)lathia(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|
|Views:||Raw Message | Whole Thread | Download mbox | Resend email|
On 2016/04/19 12:45, Etsuro Fujita wrote:
> On 2016/04/19 12:26, Michael Paquier wrote:
>> Note for Robert: pgfdw_get_result copycats PQexec by discarding all
>> PQresult received except the last one. I think that's fine for the
>> purposes of postgres_fdw, but perhaps you have a different opinion on
>> the matter.
> That seemed reasonable to me, but sorry, on second thought, I'm not sure
> that's still a good idea. One reason is (1) I think it's better for the
> in-postgres_fdw.c functions using pgfdw_get_result to verify that there
> are no more results, in itself. I think that would improve the
> robustness of those functions. Another reason is I don't think
> pgfdw_report_error, which is used in pgfdw_get_result, works well for
> cases where the query contains multiple SQL commands. So, +1 for the
> idea of simply encapsulating the while (PQisBusy(...)) loop into a new
> function pgfdw_get_result().
Here is a proposed patch for that.
* We don't use a PG_TRY block here, so be careful not to throw error
* without releasing the PGresult.
- res = PQexecPrepared(fmstate->conn,
+ if (!PQsendQueryPrepared(fmstate->conn,
+ pgfdw_report_error(ERROR, NULL, fmstate->conn, true, fmstate->query);
The comment "We don't use a PG_TRY block here ..." seems to be wrongly
placed, so I moved that comment. Also, I think it'd be better to call
pgfdw_report_error() with the clear argument set to false, not true,
since we don't need to clear the PGresult. Same for
postgresExecForeignUpdate, postgresExecForeignUpdate, and
What do you think about that?
|Next Message||Noah Misch||2016-04-19 04:16:31||Re: [COMMITTERS] pgsql: Add trigonometric functions that work in degrees.|
|Previous Message||Tom Lane||2016-04-19 03:56:55||Re: [COMMITTERS] pgsql: Add trigonometric functions that work in degrees.|