Commit cb92703
committed
Adjust batch size in postgres_fdw to not use too many parameters
The FE/BE protocol identifies parameters with an Int16 index, which
limits the maximum number of parameters per query to 65535. With
batching added to postges_fdw this limit is much easier to hit, as
the whole batch is essentially a single query, making this error much
easier to hit.
The failures are a bit unpredictable, because it also depends on the
number of columns in the query. So instead of just failing, this patch
tweaks the batch_size to not exceed the maximum number of parameters.
Reported-by: Hou Zhijie <houzj.fnst@cn.fujitsu.com>
Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Discussion: https://postgr.es/m/OS0PR01MB571603973C0AC2874AD6BF2594299%40OS0PR01MB5716.jpnprd01.prod.outlook.com1 parent d1f0aa7 commit cb92703
File tree
6 files changed
+52
-11
lines changed- contrib/postgres_fdw
- expected
- sql
- doc/src/sgml
- src/interfaces/libpq
6 files changed
+52
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9680 | 9680 | | |
9681 | 9681 | | |
9682 | 9682 | | |
| 9683 | + | |
| 9684 | + | |
| 9685 | + | |
| 9686 | + | |
| 9687 | + | |
| 9688 | + | |
| 9689 | + | |
| 9690 | + | |
| 9691 | + | |
| 9692 | + | |
| 9693 | + | |
9683 | 9694 | | |
9684 | 9695 | | |
9685 | 9696 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2030 | 2030 | | |
2031 | 2031 | | |
2032 | 2032 | | |
2033 | | - | |
| 2033 | + | |
2034 | 2034 | | |
2035 | 2035 | | |
2036 | 2036 | | |
| |||
2045 | 2045 | | |
2046 | 2046 | | |
2047 | 2047 | | |
2048 | | - | |
| 2048 | + | |
| 2049 | + | |
| 2050 | + | |
| 2051 | + | |
| 2052 | + | |
| 2053 | + | |
| 2054 | + | |
| 2055 | + | |
2049 | 2056 | | |
2050 | 2057 | | |
2051 | 2058 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3026 | 3026 | | |
3027 | 3027 | | |
3028 | 3028 | | |
| 3029 | + | |
| 3030 | + | |
| 3031 | + | |
| 3032 | + | |
| 3033 | + | |
| 3034 | + | |
| 3035 | + | |
3029 | 3036 | | |
3030 | 3037 | | |
3031 | 3038 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
372 | 372 | | |
373 | 373 | | |
374 | 374 | | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
375 | 386 | | |
376 | 387 | | |
377 | 388 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1403 | 1403 | | |
1404 | 1404 | | |
1405 | 1405 | | |
1406 | | - | |
| 1406 | + | |
1407 | 1407 | | |
1408 | | - | |
1409 | | - | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
1410 | 1411 | | |
1411 | 1412 | | |
1412 | 1413 | | |
| |||
1451 | 1452 | | |
1452 | 1453 | | |
1453 | 1454 | | |
1454 | | - | |
| 1455 | + | |
1455 | 1456 | | |
1456 | | - | |
1457 | | - | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
1458 | 1460 | | |
1459 | 1461 | | |
1460 | 1462 | | |
| |||
1548 | 1550 | | |
1549 | 1551 | | |
1550 | 1552 | | |
1551 | | - | |
| 1553 | + | |
1552 | 1554 | | |
1553 | | - | |
1554 | | - | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
1555 | 1558 | | |
1556 | 1559 | | |
1557 | 1560 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
429 | 429 | | |
430 | 430 | | |
431 | 431 | | |
| 432 | + | |
| 433 | + | |
432 | 434 | | |
433 | 435 | | |
434 | 436 | | |
| |||
0 commit comments