You could easily create a console application with Lazarus or Delphi to
do this, the console app could read the script from params, standard
input, or a text file and execute it
against the server of your choice using ODBC or a native interface to libpq.
Tony