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

Re: saving a query and reults to a file.

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
Cc: Christian Hofmann <christian(dot)hofmann(at)gmx(dot)de>, pgsql-novice(at)postgresql(dot)org
Subject: Re: saving a query and reults to a file.
Date: 2005-11-29 22:48:42
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
On Tue, 2005-11-29 at 20:47 +0100, A. Kretschmer wrote:
> am  29.11.2005, um 18:38:50 +0000 mailte Oliver Elphick folgendes:
> > On Tue, 2005-11-29 at 11:35 -0500, T. Lackey wrote:
> > > Is there an easy way to save a series of queries and query results to
> > > a single file like /tee in MySQL?  I am running version 8.-beta4 on
> > > windows XP.
> > 
> > In psql:
> > 
> > \o output_file_name
> > ...various queries...
> > \o
> This isn't the right answer. \o redirect _only_ query results to the
> file, not the queries.
> And yes, i don't know the answer.

Of course, you are right.  I tried psql -e and -a and -L and none of
them do it.  The only way to get the queries into the output file as
well is to copy them there separately:

  \o output_file_name
  \qecho SELECT * FROM my_table;
  SELECT * FROM my_table;

It's a bit cumbersome.

The other way is to capture the whole session output.  In Linux you can
do that with the script command, but I don't know if Windows has any
decent tools like that.

Oliver Elphick                                          olly(at)lfix(dot)co(dot)uk
Isle of Wight                    
GPG: 1024D/A54310EA  92C8 39E7 280E 3631 3F0E  1EC0 5664 7A2F A543 10EA
   Do you want to know God?

In response to


pgsql-novice by date

Next:From: operationsengineer1Date: 2005-11-29 23:21:26
Subject: Re: saving a query and reults to a file.
Previous:From: A. KretschmerDate: 2005-11-29 19:47:08
Subject: Re: saving a query and reults to a file.

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