I'm testing a simple data load into a table that has a date time field with a default value of sysdate. I want to copy data from a file that contains the column data for the table's columns expect for the date time field. I want that field to simply default to sysdate during the COPY.
Here's my table:
Code: Select all
debfawn=> \d test_load;
List of Fields by Tables
Schema | Table | Column | Type | Size | Default | Not Null | Primary Key | Foreign Key
--------------+-----------+--------+-------------+------+-------------+----------+-------------+-------------
deb_test_01 | test_load | a | int | 8 | | f | f |
deb_test_01 | test_load | b | varchar(80) | 80 | | f | f |
deb_test_01 | test_load | c | timestamp | 8 | "sysdate"() | f | f |
(3 rows)
Code: Select all
debfawn=> \! cat test_load.txt
1|DEB
2|FAWN
Code: Select all
debfawn=> copy test_load from '/usr/home/debfawn/test_load.txt' EXCEPTIONS '/usr/home/debfawn/test_load.log';
Rows Loaded
-------------
0
(1 row)
Code: Select all
debfawn=> \! cat /usr/home/debfawn/test_load.log
COPY: Input record 1 has been rejected (Too few columns found). Please see /usr/local/data/deb/v_deb_01_node0001_catalog/CopyErrorLogs/test_load-test_load.txt-copy-from-rejected-data, record 1 for the rejected record.
COPY: Input record 2 has been rejected (Too few columns found). Please see /usr/local/data/deb/v_deb_node0001_catalog/CopyErrorLogs/test_load-test_load.txt-copy-from-rejected-data, record 2 for the rejected record.
COPY: Loaded 0 rows, rejected 2 rows.
Thank you