Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgadmin-supportpgsql-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

pgadmin-support by date

Next:From: Francisco ReyesDate: 2008-07-30 14:18:36
Subject: Re: Problem running script
Previous:From: Sushma SagaramDate: 2008-07-25 17:20:01
Subject: Problem running script

pgsql-general by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group