Thread: Re: batch file

Re: batch file

From
missive@frontiernet.net (Lee Harr)
Date:
> In the postgresql tutorial it is explained how to enter commands one by
> one, I was wondering whether it is possible to first put a series of
> commands in an ascii file and then read in that file with psql. Here are
> my questions:
> 1. What should be the default extension of such a file

I do not know of a standard. How about .sql ?

> 2. Which command in psql should I use to read in suc a file

\i commands.sql

Also, take a look at \? which will show you other goodies.



Re: batch file

From
Rich Shepard
Date:
On Thu, 21 Feb 2002, Lee Harr wrote:

> > 2. Which command in psql should I use to read in suc a file
>
> \i commands.sql

  Or, use 'psql -f <filename>'. You can also use the '-d' switch to specify
the database to use. I just learned all this earlier this week and it works
like a charm.

Rich

Dr. Richard B. Shepard, President

                       Applied Ecosystem Services, Inc. (TM)
            2404 SW 22nd Street | Troutdale, OR 97060-1247 | U.S.A.
 + 1 503-667-4517 (voice) | + 1 503-667-8863 (fax) | rshepard@appl-ecosys.com
                         http://www.appl-ecosys.com