0

How can i run multiple sql files from one main sql files in postgres.

For example in oracle Inside Main.sql i can specify n number of @Child.sql , and then i can run Main.sql to run all child.sql 's .

How can i do this in the postgres.

Thanks! Pratik

1 Answer 1

3

\i is the psql equivalent of the Oracle SQL*Plus @ command.

If you're using psql to run the Main.sql script, you can put:

\i path/to/child.sql

... in Main.sql. The difference between this and the EXECUTE SCRIPT command pointed out by Tzury is that there the path in FILENAME would refer to a path on the server's file system, while the \i command refers to a path on the machine running psql.

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.