By Alvin Alexander. Last updated: June 4, 2016
With Postgresql (or Postgres, as I call it) you can execute commands from a file like this:
\i your_file_name_here
I just did that to run a subset of the restore commands from a backup file that I created, and it worked just fine. In my case I put the file in my current working directory, but I'll guess that you can also supply a path to the file and it will work from there as well.