Re: query to file

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Judith Altamirano Figueroa <jaltamirano(at)correolux(dot)com(dot)mx>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: query to file
Date: 2005-10-19 00:05:13
Message-ID: 20051019000513.GA44530@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tue, Oct 18, 2005 at 06:03:59PM -0500, Judith Altamirano Figueroa wrote:
> Excuse me, how can I send a query to a file?, for example the result of
> this query:
>
> select id_articulo, articulo, color_code from articulos;

If you have a shell on a platform that supports input/output
redirection then you could redirect psql's output:

psql -c 'select ...' > filename

From within psql you could use \g or \o; see the documentation for
more information.

http://www.postgresql.org/docs/8.0/interactive/app-psql.html

If you're using some other client then consult its documentation.

--
Michael Fuhr

In response to

  • query to file at 2005-10-18 23:03:59 from Judith Altamirano Figueroa

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Glaesemann 2005-10-19 00:09:56 Re: query to file
Previous Message Michael Fuhr 2005-10-18 23:51:35 Re: Problem -Postgre sql