Thread: Query result to a file

Query result to a file

From
Eduardo Vázquez Rodríguez
Date:
Hi everybody out there using Postgres.

I am using PgAdminIII & I would like that my query results that appears
on the console might be redirected to a file or to a temporary table.


Someone suggested in this list that I redirect the output of the query
using the "query" > file, but my intention is that the new file must be
on the client side.

My goal is to create a graphic from the query results and procesing the
data from the text file.


Any suggestions are welcome. :-)

Re: Query result to a file

From
Eduardo Vázquez Rodríguez
Date:
Thanks I have found it

Ron St-Pierre wrote:

> Eduardo Vázquez Rodríguez wrote:
>
>> Hi everybody out there using Postgres.
>>
>> I am using PgAdminIII & I would like that my query results that
>> appears on the console might be redirected to a file or to a temporary
>> table.
>>
>>
>> Someone suggested in this list that I redirect the output of the query
>> using the "query" > file, but my intention is that the new file must
>> be on the client side.
>>
>> My goal is to create a graphic from the query results and procesing
>> the data from the text file.
>>
>>
>> Any suggestions are welcome. :-)
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 2: you can get off all lists at once with the unregister command
>>    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>>
>>
> Doesn't pgAdminIII have an option to output the results to the screen,
> to a text file, to html, or to an excel spreadsheet? In pgAdminII it's a
> dropdown box at the bottom of the SQL input window.
>
> Ron
>

--
Eduardo Vázquez Rodríguez <evazquez@insys-corp.com.mx>
Consultoría Implantación
Tel. 5322 5200

Re: Query result to a file

From
Ron St-Pierre
Date:
Eduardo Vázquez Rodríguez wrote:

> Hi everybody out there using Postgres.
>
> I am using PgAdminIII & I would like that my query results that
> appears on the console might be redirected to a file or to a temporary
> table.
>
>
> Someone suggested in this list that I redirect the output of the query
> using the "query" > file, but my intention is that the new file must
> be on the client side.
>
> My goal is to create a graphic from the query results and procesing
> the data from the text file.
>
>
> Any suggestions are welcome. :-)
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
>
Doesn't pgAdminIII have an option to output the results to the screen,
to a text file, to html, or to an excel spreadsheet? In pgAdminII it's a
dropdown box at the bottom of the SQL input window.

Ron


Re: Query result to a file

From
Christian Poecher
Date:
Eduardo Vázquez Rodríguez wrote:
> Someone suggested in this list that I redirect the output of the query
> using the "query" > file, but my intention is that the new file must be
> on the client side.

Actually Oliver used a client side approach. postmaster is the usual
server process and psql one possible client. psql -h HOSTNAME starts the
client process, if you are remote. You might have to compile psql for
your client system, though.

HTH, chris

Re: Query result to a file

From
Oliver Elphick
Date:
On Tue, 2004-08-10 at 22:33, Christian Poecher wrote:
> Eduardo Vázquez Rodríguez wrote:
> > Someone suggested in this list that I redirect the output of the query
> > using the "query" > file, but my intention is that the new file must be
> > on the client side.
>
> Actually Oliver used a client side approach. postmaster is the usual
> server process and psql one possible client. psql -h HOSTNAME starts the
> client process, if you are remote.

Yes.  However I confused things by saying that the path specified by \o
needed to be writable by the backend.  That is rubbish, of course, since
\o is executed by psql, not the backend.

--
Oliver Elphick                                          olly@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA  92C8 39E7 280E 3631 3F0E  1EC0 5664 7A2F A543 10EA
                 ========================================
     "Be still before the LORD and wait patiently for him;
      do not fret when men succeed in their ways, when they
      carry out their wicked schemes."
                            Psalms 37:7