pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: Japin Li <japinli@hotmail.com>
Cc: pgsql-hackers@postgresql.org
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: postgres_fdw: Fix bug in checking of return value of PQsendQuery().
Date: Fri, 22 Jul 2022 12:07:28 +0900
Message-ID: <bc4ddc79-2115-02d0-7dab-baa269d7a769@oss.nttdata.com> (raw)
In-Reply-To: <MEYP282MB1669E6C96BE822ECF13F87A7B6919@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM>
References: <b187a7cf-d4e3-5a32-4d01-8383677797f3@oss.nttdata.com>
	<MEYP282MB1669E6C96BE822ECF13F87A7B6919@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM>



On 2022/07/21 23:41, Japin Li wrote:
> 
> On Thu, 21 Jul 2022 at 22:22, Fujii Masao <masao.fujii@oss.nttdata.com> wrote:
>> Hi,
>>
>> I found that fetch_more_data_begin() in postgres_fdw reports an error when PQsendQuery() returns the value less than 0 as follows though PQsendQuery() can return only 1 or 0. I think this is  a bug. Attached is the patch that fixes this bug. This needs to be back-ported to v14 where async execution was supported in postgres_fdw.
>>
>> 	if (PQsendQuery(fsstate->conn, sql) < 0)
>> 		pgfdw_report_error(ERROR, NULL, fsstate->conn, false, fsstate->query);
>>
>> Regards,
> 
> +1.  However, I think check whether the result equals 0 or 1 might be better.

Maybe. I just used "if (!PQsendQuery())" style because it's used in postgres_fdw elsewhere.

> Anyway, the patch works correctly.

Thanks for the review! Pushed.

Regards,

-- 
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION





view thread (5+ messages)  latest in thread

Message-ID: <bc4ddc79-2115-02d0-7dab-baa269d7a769@oss.nttdata.com>
Permalink:  ../bc4ddc79-2115-02d0-7dab-baa269d7a769@oss.nttdata.com/
Also on:    postgresql.org/message-id/bc4ddc79-2115-02d0-7dab-baa269d7a769@oss.nttdata.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: masao.fujii@oss.nttdata.com, japinli@hotmail.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: postgres_fdw: Fix bug in checking of return value of PQsendQuery().
  In-Reply-To: <bc4ddc79-2115-02d0-7dab-baa269d7a769@oss.nttdata.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox