0

I want create a file.sql that execute with:

> psql -f file.sql

in this file I want create some schemas and tables end execute other sql files:

file.sql:

create schema a ...
create schema b...
create table a.t1
create table b.t2...

execute /path/file2.sql;
execute /path/file3.sql;

Is possible?

1 Answer 1

2

Yes, it is.

\i /path/file2.sql;
\i /path/file3.sql
Sign up to request clarification or add additional context in comments.

3 Comments

with the command \i fun\on.sql; in windows: psql:winInstall.sql:5: fun: Permission denied
ok i resolve with \ but if i want make a file for linux and windows there is a solution or i must create 2 different files?
You can use forward-slash paths on windows too.

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.