Thread: pgsql: Disallow setting MAX_PARTITION_BUFFERS to less than 2

pgsql: Disallow setting MAX_PARTITION_BUFFERS to less than 2

From
David Rowley
Date:
Disallow setting MAX_PARTITION_BUFFERS to less than 2

Add some comments to mention that this value must be at least 2 and also
add a StaticAssertDecl to cause compilation failure if anyone tries to
build with an invalid value.

The multiInsertBuffers list must have at least two elements due to how the
code in CopyMultiInsertInfoFlush() pushes the current ResultRelInfo's
CopyMultiInsertBuffer to the end of the list.  If the first element is
also the last element, bad things will happen.

Author: Zhang Mingli <avamingli@gmail.com>
Discussion: https://postgr.es/m/CAApHDvpQ6t9ROcqbD-OgqR04Kfq4vQKw79Vo6r5j%2BciHwsSfkA%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c19615fe391c9577e2129fed4429736f6b5295da

Modified Files
--------------
src/backend/commands/copyfrom.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)