postgres_fdw: Fix bug in checking of return value of PQsendQuery().

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: postgres_fdw: Fix bug in checking of return value of PQsendQuery().
Date: 2022-07-21 14:22:26
Message-ID: b187a7cf-d4e3-5a32-4d01-8383677797f3@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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,

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

Attachment Content-Type Size
0001-postgres_fdw-Fix-bug-in-checking-of-return-value-of-.patch text/plain 1.6 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2022-07-21 14:40:19 Re: Custom tuplesorts for extensions
Previous Message Aleksander Alekseev 2022-07-21 14:21:35 Re: [PATCH v1] eliminate duplicate code in table.c