pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fujii Masao <fujii@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Refactor CopyFrom() in copyfrom.c.
Date: Thu, 03 Oct 2024 07:01:12 +0000
Message-ID: <E1swFpo-001xv9-Cn@gemulon.postgresql.org> (raw)

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

Branch
------
master

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

Modified Files
--------------
src/backend/commands/copyfrom.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)



Message-ID: <E1swFpo-001xv9-Cn@gemulon.postgresql.org>
Permalink:  ../E1swFpo-001xv9-Cn@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1swFpo-001xv9-Cn@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: fujii@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Refactor CopyFrom() in copyfrom.c.
  In-Reply-To: <E1swFpo-001xv9-Cn@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox