Execute several .sql files in a single transaction using PostgreSQL and bash

后端 未结 4 1386
闹比i
闹比i 2021-01-02 08:50

Say I have the files:

file1.sql
file2.sql
file3.sql

I need all three files to be executed in a single transaction. I\'m looking for a bash

4条回答
  •  离开以前
    2021-01-02 09:22

    You can also use the -1 or --single-transaction option to execute all your scripts in a transaction:

    cat file*.sql | psql -1
    

提交回复
热议问题