Re: Problem running script - Mailing list pgsql-general

From Ian Lea
Subject Re: Problem running script
Date
Msg-id 8c4e68610807300650i69e52707tb2fc4813ce8463da@mail.gmail.com
Whole thread Raw
In response to Problem running script  ("Sushma Sagaram" <sushma.2276@gmail.com>)
Responses Re: Problem running script
List pgsql-general
If you are on unix just run

$ psql -whatever < test.sql > test.log

Don't know about Windows.


--
Ian.


On Fri, Jul 25, 2008 at 6:20 PM, Sushma Sagaram <sushma.2276@gmail.com> wrote:
> My requirement is
> 1) to write a query in a file, read the input from that file, run in
> postgresql and write the output(query results) into a file. I'm not able to
> use combination of \i and \o
> Let' say I have file test.sql and in test.sql I write
> select * from abc;
>  Now I need to read the query from the file and write the output to a file.
> I tried
> =>\i test.sql \o test
> but that is not working. I want to write a script which reads query from
> file and write output in a file and I want to do everything in one script
> and run it background at a particular time of teh day.
> 2) How do I run scripts in postgresql? How do I set the shell and execute
> the script?
>
> Regards,
> Sushma
>
>

pgsql-general by date:

Previous
From: "Garg, Manjit"
Date:
Subject: Re: Clone a database to other machine
Next
From: "Francisco Reyes"
Date:
Subject: Re: Problem running script