Re: Writing output to a file

From: Richard Huxton <dev(at)archonet(dot)com>
To: Chris Gordon <thegordonemail(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Writing output to a file
Date: 2005-11-30 09:20:28
Message-ID: 438D6EDC.5070903@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Chris Gordon wrote:
> I have used \o foo.txt and it seems to write significantly less than what I
> see on the screen. Has anyone had experience with this?

That's by design - it just shows results by default. I think you want to
capture STDOUT/ERR rather like this:

$ psql --echo-all -Urichardh richardh < test.sql > res.sql 2>&1

$ cat test.sql
\qecho hello world
\timing
SELECT * FROM nametest;
\d nametest

$ cat res.sql
\qecho hello world
hello world
\timing
Timing is on.
SELECT * FROM nametest;
first | last | extra
-------+------+-------
(0 rows)

Time: 5.526 ms
\d nametest
Table "public.nametest"
Column | Type | Modifiers
--------+-----------------------+-----------
first | character varying(32) |
last | character varying(32) |
extra | character varying(32) |

That any help?

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-general by date

  From Date Subject
Next Message surabhi.ahuja 2005-11-30 10:08:06 Re: memory leak under heavy load?
Previous Message Együd Csaba 2005-11-30 08:59:03 Re: Login limitation?