Provide a FORCE NULL option to COPY in CSV mode.
Andrew Dunstan <andrew@dunslane.net>
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.
Files
| Path | Change | +/− |
|---|---|---|
| contrib/file_fdw/data/text.csv | modified | +5 −4 |
| contrib/file_fdw/file_fdw.c | modified | +57 −14 |
| contrib/file_fdw/input/file_fdw.source | modified | +16 −1 |
| contrib/file_fdw/output/file_fdw.source | modified | +33 −8 |
| doc/src/sgml/file-fdw.sgml | modified | +18 −3 |
| doc/src/sgml/ref/copy.sgml | modified | +18 −1 |
| src/backend/commands/copy.c | modified | +70 −4 |
| src/backend/parser/gram.y | modified | +4 −0 |
| src/test/regress/expected/copy2.out | modified | +48 −0 |
| src/test/regress/sql/copy2.sql | modified | +39 −0 |