pgsql: Provide a FORCE NULL option to COPY in CSV mode. - Mailing list pgsql-committers

From Andrew Dunstan
Subject pgsql: Provide a FORCE NULL option to COPY in CSV mode.
Date
Msg-id E1WKy0s-0001gr-Tn@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Provide a FORCE NULL option to COPY in CSV mode.

This forces an input field containing the quoted null string to be
returned as a NULL. Without this option, only unquoted null strings
behave this way. This helps where some CSV producers insist on quoting
every field, whether or not it is needed. The option takes a list of
fields, and only applies to those columns. There is an equivalent
column-level option added to file_fdw.

Ian Barwick, with some tweaking by Andrew Dunstan, reviewed by Payal
Singh.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/3b5e03dca2afea7a2c12dbc8605175d0568b5555

Modified Files
--------------
contrib/file_fdw/data/text.csv          |    9 ++--
contrib/file_fdw/file_fdw.c             |   71 +++++++++++++++++++++++------
contrib/file_fdw/input/file_fdw.source  |   17 ++++++-
contrib/file_fdw/output/file_fdw.source |   41 +++++++++++++----
doc/src/sgml/file-fdw.sgml              |   21 +++++++--
doc/src/sgml/ref/copy.sgml              |   19 +++++++-
src/backend/commands/copy.c             |   74 +++++++++++++++++++++++++++++--
src/backend/parser/gram.y               |    4 ++
src/test/regress/expected/copy2.out     |   48 ++++++++++++++++++++
src/test/regress/sql/copy2.sql          |   39 ++++++++++++++++
10 files changed, 308 insertions(+), 35 deletions(-)


pgsql-committers by date:

Previous
From: Alvaro Herrera
Date:
Subject: pgsql: auto_explain: Add logging of trigger execution
Next
From: Bruce Momjian
Date:
Subject: Re: pgsql: Various Coverity-spotted fixes