Thread: Redirecting Output

Redirecting Output

From
benc1@today.com.au (Ben C)
Date:
Hi there,

I am hoping that someone can point me to the docs where I will find
the answer to this problem ... all I am trying to do is redirect
output from a select statement (from either an SQL or PL\pgsql
function) to a text file ... seems simple enough ... however after
reading as many docs/books that I can find I have not been able to
find a solution ... is it possible?? If so would someone be kind
enough to point me to some documentation re: this?

thanks

Ben

Re: Redirecting Output

From
"Jeff MacDonald"
Date:
on the command line

psql -c "select * from my_table" databasename username > textfile.dat



> -----Original Message-----
> From: pgsql-general-owner@postgresql.org
> [mailto:pgsql-general-owner@postgresql.org]On Behalf Of Ben C
> Sent: Sunday, June 23, 2002 7:28 PM
> To: pgsql-general@postgresql.org
> Subject: [GENERAL] Redirecting Output
>
>
> Hi there,
>
> I am hoping that someone can point me to the docs where I will find
> the answer to this problem ... all I am trying to do is redirect
> output from a select statement (from either an SQL or PL\pgsql
> function) to a text file ... seems simple enough ... however after
> reading as many docs/books that I can find I have not been able to
> find a solution ... is it possible?? If so would someone be kind
> enough to point me to some documentation re: this?
>
> thanks
>
> Ben
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>
>
>



Re: Redirecting Output

From
Martijn van Oosterhout
Date:
On Sun, Jun 23, 2002 at 03:28:21PM -0700, Ben C wrote:
> Hi there,
>
> I am hoping that someone can point me to the docs where I will find
> the answer to this problem ... all I am trying to do is redirect
> output from a select statement (from either an SQL or PL\pgsql
> function) to a text file ... seems simple enough ... however after
> reading as many docs/books that I can find I have not been able to
> find a solution ... is it possible?? If so would someone be kind
> enough to point me to some documentation re: this?

Also, in psql you can use the \g command

--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> There are 10 kinds of people in the world, those that can do binary
> arithmetic and those that can't.