Depends on how you place the query? I assume you are asking about the psql client, so before the query just do:
\o output.txt
you can see several options/switches by giving \?
regards,
thalis
On Fri, 15 Feb 2002, Peter Peltonen wrote:
>
> A basic question:
>
> How in PostgreSQL do I redirect the output of an SQL query to a textfile?
>
> --
> Peter Peltonen
> System Administrator
> Fivetec Solutions Oy
>
> Melkonkatu 28 E
> 00210 Helsinki
> GSM. +358-40 720 6535
> Tel. +358-9-6824 7666
> Fax. +358-9-6824 7664
> http://www.fivetec.com
> mailto:peter.peltonen@fivetec.com
> --
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>