Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm developing a really long script. I'd like to break the script into smaller, more manageable scripts and include each sql file in a master file, then just execute the master file.

example: master.sql

contents (I don't know the syntax to use):


I've found several tutorials about using psql -f in the command-line and \i to include these files, but the preference here is to avoid the terminal and use a GUI to manage my database and execute the master.sql script.

Is this possible in any postgres admin GUI? Presumably it's not in pgAdmin.

share|improve this question
You can edit your SQL files in any editor (there are much better options than pgAdmin) and then only run a single command in psql (say psql -f master.sql). – dezso Mar 12 '13 at 20:15
OK, then I will be clear: you presumably can't do that in pgAdmin. Anyway, I can't really see why this is a problem (I may be too used to this limitation). – dezso Mar 13 '13 at 8:41
Thanks for the comment. And you'll be able to see that it is a problem without a solution if you attempt to do what I want in pgAdmin. It may be a limitation (WADU) of pgAdmin, as you say, so I'll edit my question to open it up to asking for ANY postgres GUI that will do this. – jbits Mar 13 '13 at 18:34
SQL Workbench/J can do that: – a_horse_with_no_name Mar 13 '13 at 22:59
Thanks @a_horse_with_no_name. I noticed in the URL referenced that: "If the included SQL script contains SELECT queries, the result of those queries will not be displayed in the GUI". My scripts have many select statements. To confirm this disclaimer, I tested this product using the WbInclude command on a very simple script containing a select and confirmed it doesn't display the results. I wonder why? Anyway, aside from that, this product definitely works at calling other scripts within scripts. – jbits Mar 14 '13 at 7:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.