Re: Running sql files

From: "Pradeepkumar, Pyatalo (IE10)" <Pradeepkumar(dot)Pyatalo(at)honeywell(dot)com>
To: Michael Fuhr <mike(at)fuhr(dot)org>, "Pradeepkumar, Pyatalo (IE10)" <Pradeepkumar(dot)Pyatalo(at)honeywell(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Running sql files
Date: 2004-12-08 05:23:44
Message-ID: 77ED2BF75D59D1439F90412CC5B1097415AB2B0A@ie10-sahara.hiso.honeywell.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin


Hi all,

Thanks a lot for all your valuable inputs. I tried "\set QUIET" and "\unset
QUIET" arount certain parts of the file. It works fine with INSERT COMMANDS.
But incase of creating tables, it still prints NOTICE and ERROR messages on
the screen...how do I restrict that.

Regs,
Pradeep

-----Original Message-----
From: Michael Fuhr [mailto:mike(at)fuhr(dot)org]
Sent: Tuesday, December 07, 2004 10:32 PM
To: Pradeepkumar, Pyatalo (IE10)
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: [ADMIN] Running sql files

On Tue, Dec 07, 2004 at 04:55:24AM -0700, Pradeepkumar, Pyatalo (IE10)
wrote:

> $psql dbname < sqlfile
> The results of the command are displayed on to the screen. In one
> file I am trying to populate a table with values ( There are more than
> 5000 tuples to be inserted).
> When I run this command, it displays the results on to the screen
> which I don't want to do.

As someone else suggested, you could redirect the script's output to
/dev/null. You could also use psql's -q ("quiet") option or surround
certain parts of the file with "\set QUIET" and "\unset QUIET".

COPY is quieter and more efficient than INSERT, so if you're using INSERT
then you could replace it with the appropriate COPY statement.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Michael Fuhr 2004-12-08 05:42:40 Re: Running sql files
Previous Message Ari Johannesson 2004-12-07 18:17:48 How to temporarily disable referntial integrity?