From: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Add header matching mode to COPY FROM |
Date: | 2022-03-30 07:10:07 |
Message-ID: | E1nZST0-00218v-Eg@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Add header matching mode to COPY FROM
COPY FROM supports the HEADER option to silently discard the header
line from a CSV or text file. It is possible to load by mistake a
file that matches the expected format, for example, if two text
columns have been swapped, resulting in garbage in the database.
This adds a new option value HEADER MATCH that checks the column names
in the header line against the actual column names and errors out if
they do not match.
Author: Rémi Lapeyre <remi(dot)lapeyre(at)lenstra(dot)fr>
Reviewed-by: Daniel Verite <daniel(at)manitou-mail(dot)org>
Reviewed-by: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Discussion: https://www.postgresql.org/message-id/flat/CAF1-J-0PtCWMeLtswwGV2M70U26n4g33gpe1rcKQqe6wVQDrFA(at)mail(dot)gmail(dot)com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/072132f04e55c1c3b0f1a582318da78de7334379
Modified Files
--------------
contrib/file_fdw/expected/file_fdw.out | 19 ++++++++++-
contrib/file_fdw/sql/file_fdw.sql | 9 +++++
doc/src/sgml/ref/copy.sgml | 8 +++--
src/backend/commands/copy.c | 60 +++++++++++++++++++++++++++++++++-
src/backend/commands/copyfromparse.c | 53 ++++++++++++++++++++++++++++--
src/include/commands/copy.h | 13 +++++++-
src/test/regress/expected/copy.out | 23 +++++++++++++
src/test/regress/sql/copy.sql | 33 +++++++++++++++++++
8 files changed, 210 insertions(+), 8 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Daniel Gustafsson | 2022-03-30 07:10:17 | Re: pgsql: Add function to pump IPC process until string match |
Previous Message | Michael Paquier | 2022-03-30 04:34:30 | pgsql: Add TAP test in pg_dump with --format=tar and --compress |