pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Dunstan <andrew@dunslane.net>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: introduce CopyFormat, refactor CopyFormatOptions
Date: Fri, 20 Mar 2026 12:41:00 +0000
Message-ID: <E1w3Z9v-000dj2-1l@gemulon.postgresql.org> (raw)

introduce CopyFormat, refactor CopyFormatOptions

Currently, the COPY command format is determined by two boolean fields
(binary, csv_mode) in CopyFormatOptions.  This approach, while
functional, isn't ideal for implementing other formats in the future.

To simplify adding new formats, introduce a CopyFormat enum.  This makes
the code cleaner and more maintainable, allowing for easier integration
of additional formats down the line.

Author: Joel Jacobson <joel@compiler.org>
Author: jian he <jian.universality@gmail.com>
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>
Discussion: https://postgr.es/m/CALvfUkBxTYy5uWPFVwpk_7ii2zgT07t3d-yR_cy4sfrrLU%3Dkcg%40mail.gmail.com
Discussion: https://postgr.es/m/6a04628d-0d53-41d9-9e35-5a8dc302c34c@joeconway.com

Branch
------
master

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

Modified Files
--------------
src/backend/commands/copy.c          | 50 +++++++++++++++++++-----------------
src/backend/commands/copyfrom.c      |  6 ++---
src/backend/commands/copyfromparse.c |  7 ++---
src/backend/commands/copyto.c        |  8 +++---
src/include/commands/copy.h          | 13 ++++++++--
src/tools/pgindent/typedefs.list     |  1 +
6 files changed, 49 insertions(+), 36 deletions(-)



Message-ID: <E1w3Z9v-000dj2-1l@gemulon.postgresql.org>
Permalink:  ../E1w3Z9v-000dj2-1l@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1w3Z9v-000dj2-1l@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: andrew@dunslane.net, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: introduce CopyFormat, refactor CopyFormatOptions
  In-Reply-To: <E1w3Z9v-000dj2-1l@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