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

RE: Capturing all output from psql into a file

From: "Rob Arnold" <rob(at)cabrion(dot)com>
To: <pgsql-novice(at)postgresql(dot)org>, "Huy Do" <huy(at)travel(dot)com(dot)au>
Subject: RE: Capturing all output from psql into a file
Date: 2000-12-21 00:47:53
Message-ID: 000201c06ae7$a70dc120$ (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
Assuming you are on Linux/Unix:

psql YOURDBNAME -e < sqlscript.txt > output.txt 2>&1

The -e option echos the script too which is helpful when debugging.

On NT do this: 

(see Q110930 for more info)

psql YOURDBNAME -e < sqlscript.txt 1> output.txt 2>&1


From:  Huy Do [SMTP:huy(at)travel(dot)com(dot)au]
Sent:  Wednesday, December 20, 2000 12:37 AM
To:  pgsql-novice(at)postgresql(dot)org
Subject:  Capturing all output from psql into a file


I am doing this mass table creation (approx 600 tables) and then
mass dump of records into these tables (~900megs of flat files).

All the table creation and record copy is being done from a file
using \i sqlscript.txt.

How can I capture all the output which comes out from psql. I need
all the errors and not just the query result.

I have tried to use \o file.txt and \g file.txt but they only
seem to output the query result.

Many thanks.


Attachment: winmail.dat
Description: application/ms-tnef (3.0 KB)

pgsql-novice by date

Next:From: Karla PeraltaDate: 2000-12-21 11:28:52
Subject: Transactions
Previous:From: Steve WaldmanDate: 2000-12-20 19:55:03
Subject: Re: Java vs. PHP (was web interface for postgreSQL-P.S.)

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