Re: Problem running script

From: "Ian Lea" <ian(dot)lea(at)gmail(dot)com>
To: "Sushma Sagaram" <sushma(dot)2276(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Problem running script
Date: 2008-07-30 13:50:00
Message-ID: 8c4e68610807300650i69e52707tb2fc4813ce8463da@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support 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(dot)2276(at)gmail(dot)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
>
>

In response to

Responses

Browse pgadmin-support by date

  From Date Subject
Next Message Francisco Reyes 2008-07-30 14:18:36 Re: Problem running script
Previous Message Sushma Sagaram 2008-07-25 17:20:01 Problem running script

Browse pgsql-general by date

  From Date Subject
Next Message Francisco Reyes 2008-07-30 14:18:36 Re: Problem running script
Previous Message Ragnar 2008-07-30 12:52:26 Re: Must be table owner to truncate?