Restoring multiple files to multiple database with pg_restore I have multiple dump files and want to restore them with single command. something like this

pg_restore  -h localhost -p 5432 -U postgres 
    -d gl_election gl_world gl_tourism 
    -c "gl_election" "gl_world" "gl_tourism"


This command doesn't work and I can't find how to do it correctly. It works fine for one file.
pg_restore doesn't take multiple filenames, nor multiple databases (-d) end of story. So use a simple shell loop. I assume you're trying to


Clear out the old database
Load up a dump to the database with the same name


That loop will look like this

for dump in gl_election gl_world gl_tourism; do
  echo Clearing and reloading "$dump"
  pg_restore -h localhost -p 5432 -U postgres -d "$dump" -c "$dump"
done;