vinod hy
vinod hy

Reputation: 895

how to pass list of sql scripts files to psql using -f option

I want to know if we can pass list of sql script files using psql command.

I have test1.sql,test2.sql,test3.sql files and right now i am executing these files individually in a loop

psql -f D:\\test1.sql postgresql://postgres:secret@localhost:5432/testdb

I want to know if there is any way to pass all three files to the psql command and psql should execute it sequentially.

Upvotes: 2

Views: 1104

Answers (1)

user330315
user330315

Reputation:

You can use the -f parameter multiple times:

psql -f D:\\test1.sql -f D:\\test2.sql -f D:\\test3.sql postgresql://postgres:secret@localhost:5432/testdb

Upvotes: 3

Related Questions