I have a table with the below structure:
CREATE TABLE admin.file_status
(
feed_id bigint,
run_id text COLLATE pg_catalog."default",
extracted_date text COLLATE pg_catalog."default",
file_name text COLLATE pg_catalog."default",
start_time timestamp without time zone,
end_time timestamp without time zone,
file_size bigint,
job_type text COLLATE pg_catalog."default",
status text COLLATE pg_catalog."default",
crypt_flag character(1) COLLATE pg_catalog."default",
destination_path text COLLATE pg_catalog."default",
header_file character(1) COLLATE pg_catalog."default",
merge_status text COLLATE pg_catalog."default",
compression_status text COLLATE pg_catalog."default",
file_split_status text COLLATE pg_catalog."default",
data_transfer_status text COLLATE pg_catalog."default",
CONSTRAINT file_status_ukeyUNIQUE (run_id, file_name)
);
When I am running the below command, it executes successfully at first attempt, but I do not see any new data inserted into the table.
env 'PGOPTIONS=-c search_path=admin -c client_min_messages=error' psql -h hostname -U user -p 25011 -d xplatform -c "\copy admin.file_status(feed_id,run_id,extracted_date,file_name,start_time,file_size,file_split_status) FROM '../temp/213/split_file_list.csv' delimiter ',' csv;commit;"
When I run it the second time, I get the below error:
ERROR: duplicate key value violates unique constraint "file_status_ukey"
DETAIL: Key (run_id, file_name)=(1622722357003791, '20210420125933_NOTIFICATION_1_1.txt') already exists.
CONTEXT: COPY juniper_extd_file_status, line 1
Why do I not see any data in the table?
SELECT * FROM admin.file_status where file_name='20210420125933_NOTIFICATION_1_1.txt'and I see no output.