Reputation: 41
I have this request :
CREATE TEMP TABLE table1 (col1 text, col2 text);
COPY table1 FROM '/path/to/csv/Tab.csv' DELIMITER ',' CSV;
I want that if the file Tab.csv
exist it will run the request COPY
but if it does not exist it will go to the next request without displaying the error.
Thanks for your feedback.
Upvotes: 1
Views: 857
Reputation: 631
before the statement, try telling postgres to ignore errors
EXEC SQL WHENEVER SQLERROR CONTINUE
and then when you're done, remember to set it back ;)
Upvotes: 2