pgsql: introduce CopyFormat, refactor CopyFormatOptions

Started by Andrew Dunstan3 months ago1 messagescomitters
Jump to latest
#1Andrew Dunstan
andrew@dunslane.net

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: /messages/by-id/CALvfUkBxTYy5uWPFVwpk_7ii2zgT07t3d-yR_cy4sfrrLU=kcg@mail.gmail.com
Discussion: /messages/by-id/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(-)