pgsql: Provide a FORCE NULL option to COPY in CSV mode.

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Provide a FORCE NULL option to COPY in CSV mode.
Date: 2014-03-04 22:40:38
Message-ID: E1WKy0s-0001gr-Tn@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2014-03-05 02:06:57 Re: pgsql: Various Coverity-spotted fixes
Previous Message Alvaro Herrera 2014-03-04 18:34:00 pgsql: auto_explain: Add logging of trigger execution