Michele M
Michele M

Reputation: 147

postgresql: create a file.sql that execute more files.sql

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?

Upvotes: 0

Views: 40

Answers (1)

Craig Ringer
Craig Ringer

Reputation: 324521

Yes, it is.

\i /path/file2.sql;
\i /path/file3.sql

Upvotes: 2

Related Questions