Handling COPY FROM errors when loading with Wildcards
When using wildcards with COPY FROM, I am having difficulty with handling copy errors.
When I run this command:
COPY myTable FROM '/mydirectory/*.dat' ON ANY NODE
REJECTED DATA '/copy_errors/rejected/';
This works if /mydirectory/ has multiple files in them.
But if it is a single file, I get an error:
ERROR: COPY: Could not open rejected data file [/copy_errors/rejected/] for writing: Is a directory.
If I change things around and specify a file instead, the copy picking up multiple files from the directory would break.
This is a huge pain. Is there any workaround other than checking the number files to be picked up before issuing a copy command?