Refactor CopyFrom() in copyfrom.c.
authorFujii Masao <[email protected]>
Thu, 3 Oct 2024 06:59:16 +0000 (15:59 +0900)
committerFujii Masao <[email protected]>
Thu, 3 Oct 2024 06:59:16 +0000 (15:59 +0900)
commite55f025b059fb02b659f12f3003c160ed4674dc8
tree5eb8c7054ef093122e7197f989f71fdfae30682a
parenta1c4c8a9e1e3a53996dafa1f4ee6d4f7de2c58b2
Refactor CopyFrom() in copyfrom.c.

This commit simplifies CopyFrom() by removing the unnecessary local variable
'skipped', which tracked the number of rows skipped due to on_error = 'ignore'.
That count is already handled by cstate->num_errors, so the 'skipped' variable
was redundant.

Additionally, the condition on_error != COPY_ON_ERROR_STOP is removed.
Since on_error == COPY_ON_ERROR_IGNORE is already checked, and on_error
only has two values (ignore and stop), the additional check was redundant
and made the logic harder to read. Seemingly this was introduced
in preparation for a future patch, but the current checks don’t offer
clear value and have been removed to improve readability.

Author: Atsushi Torikoshi
Reviewed-by: Masahiko Sawada, Fujii Masao
Discussion: https://postgr.es/m/ab59dad10490ea3734cf022b16c24cfd@oss.nttdata.com
src/backend/commands/copyfrom.c