Add a DEFAULT option to COPY FROM
authorAndrew Dunstan <andrew@dunslane.net>
Mon, 13 Mar 2023 14:01:56 +0000 (10:01 -0400)
committerAndrew Dunstan <andrew@dunslane.net>
Mon, 13 Mar 2023 14:01:56 +0000 (10:01 -0400)
commit9f8377f7a27910bf0f35bf5169a8046731948a79
treee0a19449e4cebb8923dfcd1bba95a1d3363faa32
parent7b14e20b12cc8358cad9bdd05dd6b7de7f73c431
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
15 files changed:
contrib/file_fdw/data/copy_default.csv [new file with mode: 0644]
contrib/file_fdw/expected/file_fdw.out
contrib/file_fdw/file_fdw.c
contrib/file_fdw/sql/file_fdw.sql
doc/src/sgml/ref/copy.sgml
src/backend/commands/copy.c
src/backend/commands/copyfrom.c
src/backend/commands/copyfromparse.c
src/bin/psql/t/001_basic.pl
src/bin/psql/t/010_tab_completion.pl
src/bin/psql/tab-complete.c
src/include/commands/copy.h
src/include/commands/copyfrom_internal.h
src/test/regress/expected/copy2.out
src/test/regress/sql/copy2.sql