Inaccurate error message when set fdw batch_size to 0

From: "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Inaccurate error message when set fdw batch_size to 0
Date: 2021-05-08 03:38:51
Message-ID: OS0PR01MB5716415335A06B489F1B3A8194569@OS0PR01MB5716.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

When testing the fdw batch insert, I found a possible issue.

If I set the batch_size to 0 , it will throw an error:

---------------------
CREATE FOREIGN TABLE test(a int, b varchar)
SERVER testserver
OPTIONS (table_name 'testlocal', batch_size '0');
ERROR: fetch_size requires a non-negative integer value
---------------------

The error message here seems not accurate, because
I can see from the code batch_size should be positive ( > 0).

So, is it better to change the error message to “fetch_size requires a positive integer value” ?
I also found fetch_size has the similar issue, attaching a patch to fix this.

Best regards,
houzj

Attachment Content-Type Size
0001-fix-errmsg-when-set-batchsize-to-0.patch application/octet-stream 1.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2021-05-08 04:50:00 Re: Binary search in ScalarArrayOpExpr for OR'd constant arrays
Previous Message Noah Misch 2021-05-08 03:30:44 Re: Anti-critical-section assertion failure in mcxt.c reached by walsender