1

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.

1
  • 1
    In what environment are you executing these commands? Does that environment have features to test for a file's existence? Commented Jun 27, 2017 at 1:59

1 Answer 1

2

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 ;)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.