Add a DEFAULT option to COPY FROM
Andrew Dunstan <andrew@dunslane.net>
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
Files
| Path | Change | +/− |
|---|---|---|
| contrib/file_fdw/data/copy_default.csv | added | +3 −0 |
| contrib/file_fdw/expected/file_fdw.out | modified | +17 −0 |
| contrib/file_fdw/file_fdw.c | modified | +17 −3 |
| contrib/file_fdw/sql/file_fdw.sql | modified | +11 −0 |
| doc/src/sgml/ref/copy.sgml | modified | +14 −0 |
| src/backend/commands/copy.c | modified | +51 −0 |
| src/backend/commands/copyfrom.c | modified | +13 −7 |
| src/backend/commands/copyfromparse.c | modified | +77 −8 |
| src/bin/psql/t/001_basic.pl | modified | +25 −0 |
| src/bin/psql/t/010_tab_completion.pl | modified | +8 −0 |
| src/bin/psql/tab-complete.c | modified | +1 −1 |
| src/include/commands/copyfrom_internal.h | modified | +9 −5 |
| src/include/commands/copy.h | modified | +2 −0 |
| src/test/regress/expected/copy2.out | modified | +98 −0 |
| src/test/regress/sql/copy2.sql | modified | +101 −0 |
Documentation touched
Discussion
- Add support for DEFAULT specification in COPY FROM 22 messages · 2022-08-16 → 2023-03-15