Add a DEFAULT option to COPY FROM
This allows for a string which if an input field matches causes the
column's default value to be inserted. The advantage of this is that
the default can be inserted in some rows and not others, for which
non-default data is available.
The file_fdw extension is also modified to take allow use of this
option.
Israel Barth Rubio
Discussion: https://postgr.es/m/CAO_rXXAcqesk6DsvioOZ5zmeEmpUN5ktZf-9=9yu+DTr0Xr8Uw@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/9f8377f7a27910bf0f35bf5169a8046731948a79
Modified Files
--------------
contrib/file_fdw/data/copy_default.csv | 3 +
contrib/file_fdw/expected/file_fdw.out | 17 ++++++
contrib/file_fdw/file_fdw.c | 20 +++++-
contrib/file_fdw/sql/file_fdw.sql | 11 ++++
doc/src/sgml/ref/copy.sgml | 14 +++++
src/backend/commands/copy.c | 51 ++++++++++++++++
src/backend/commands/copyfrom.c | 20 +++---
src/backend/commands/copyfromparse.c | 85 +++++++++++++++++++++++---
src/bin/psql/t/001_basic.pl | 25 ++++++++
src/bin/psql/t/010_tab_completion.pl | 8 +++
src/bin/psql/tab-complete.c | 2 +-
src/include/commands/copy.h | 2 +
src/include/commands/copyfrom_internal.h | 14 +++--
src/test/regress/expected/copy2.out | 98 ++++++++++++++++++++++++++++++
src/test/regress/sql/copy2.sql | 101 +++++++++++++++++++++++++++++++
15 files changed, 447 insertions(+), 24 deletions(-)