1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-02 09:26:47 +03:00

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.
This commit is contained in:
Andrew Dunstan
2014-03-04 17:31:59 -05:00
parent e2a0fc5363
commit 3b5e03dca2
10 changed files with 308 additions and 35 deletions
contrib/file_fdw
doc/src/sgml
src
backend
commands
parser
test
regress

@ -2548,6 +2548,10 @@ copy_opt_item:
{
$$ = makeDefElem("force_not_null", (Node *)$4);
}
| FORCE NULL_P columnList
{
$$ = makeDefElem("force_null", (Node *)$3);
}
| ENCODING Sconst
{
$$ = makeDefElem("encoding", (Node *)makeString($2));