introduce CopyFormat, refactor CopyFormatOptions
Andrew 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: https://postgr.es/m/CALvfUkBxTYy5uWPFVwpk_7ii2zgT07t3d-yR_cy4sfrrLU%3Dkcg%40mail.gmail.com Discussion: https://postgr.es/m/6a04628d-0d53-41d9-9e35-5a8dc302c34c@joeconway.com
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/commands/copy.c | modified | +26 −24 |
| src/backend/commands/copyfrom.c | modified | +3 −3 |
| src/backend/commands/copyfromparse.c | modified | +4 −3 |
| src/backend/commands/copyto.c | modified | +4 −4 |
| src/include/commands/copy.h | modified | +11 −2 |
| src/tools/pgindent/typedefs.list | modified | +1 −0 |
Discussion
- Emitting JSON to file using COPY TO 163 messages · 2023-11-25 → 2026-03-20