SDReyes
SDReyes

Reputation: 9954

Run a script in multiple PostgreSQL databases

How can you run a script in multiple PostgreSQL databases in Mac?

Upvotes: 1

Views: 1702

Answers (1)

Peter Eisentraut
Peter Eisentraut

Reputation: 36759

for db in first_db second_db ...; do
    psql -d $db -f yourscript.sql
done

Of course there will be many variations depending on exactly what you want to do.

Upvotes: 4

Related Questions