2

from the postgres docs:

IF NOT EXISTS

Do not throw an error if a relation with the same name already exists. A notice is issued in this case. Note that there is no guarantee that the existing relation is anything like the one that would have been created.

often we don't care if just the name matches, we care if the schema matches. is there any way specify "if not exists" but checking that the schema also matches?

1 Answer 1

5

You can specify the schema name in the table creation statement

CREATE TABLE IF NOT EXISTS myshema.mytable AS ...
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.