Support multi-line headers in COPY FROM command.
Fujii Masao <fujii@postgresql.org>
Support multi-line headers in COPY FROM command. The COPY FROM command now accepts a non-negative integer for the HEADER option, allowing multiple header lines to be skipped. This is useful when the input contains multi-line headers that should be ignored during data import. Author: Shinya Kato <shinya11.kato@gmail.com> Co-authored-by: Fujii Masao <masao.fujii@gmail.com> Reviewed-by: Yugo Nagata <nagata@sraoss.co.jp> Discussion: https://postgr.es/m/CAOzEurRPxfzbxqeOPF_AGnAUOYf=Wk0we+1LQomPNUNtyZGBZw@mail.gmail.com
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/ref/copy.sgml | modified | +28 −10 |
| src/backend/commands/copy.c | modified | +26 −16 |
| src/backend/commands/copyfromparse.c | modified | +13 −4 |
| src/backend/commands/copyto.c | modified | +1 −1 |
| src/include/commands/copy.h | modified | +7 −9 |
| src/test/regress/expected/copy2.out | modified | +6 −0 |
| src/test/regress/expected/copy.out | modified | +24 −1 |
| src/test/regress/sql/copy2.sql | modified | +3 −0 |
| src/test/regress/sql/copy.sql | modified | +30 −0 |
| src/tools/pgindent/typedefs.list | modified | +0 −1 |
Discussion
- Extend COPY FROM with HEADER <integer> to skip multiple lines 24 messages · 2025-06-09 → 2025-07-03