This certainly looks like a bug, whether you want to characterize it as an oversight, unfinished feature, or something else.
Vertica support tells me this is a known issue and a fix is being tracked as part of VER-36735. (Unfortunately, their issue tracker is not visible to the public.)
The problem appears to be related to the
LOCAL clause, which is used to load files that are on the client machine as opposed to the server.
If you remove the
LOCAL clause (and put the files you are loading on the server), then
CURRENT_LOAD_SOURCE() will return the file name of the file being loaded, as expected.
COPY table1 (
file_name AS CURRENT_LOAD_SOURCE()
FROM :src_file -- no LOCAL!
REJECTED DATA :rejected_file
If you're stuck with the
LOCAL, then your best bet is to simply pass in a new variable (e.g.
:file_name) that you explicitly set with the name of the file you are loading. You'll just need to be sure to provide the base name of the file (as opposed to the full path), to match the intended behavior of