pgsql: introduce CopyFormat, refactor CopyFormatOptions

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: introduce CopyFormat, refactor CopyFormatOptions
Date: 2026-03-20 12:41:00
Message-ID: E1w3Z9v-000dj2-1l@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(at)compiler(dot)org>
Author: jian he <jian(dot)universality(at)gmail(dot)com>
Reviewed-by: Andrew Dunstan <andrew(at)dunslane(dot)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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2026-03-20 12:53:59 pgsql: test_plan_advice: Set TAP test priority 50 in meson.build.
Previous Message Peter Eisentraut 2026-03-20 10:08:46 pgsql: Cleanup users and roles in graph_table_rls test