pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <pgman@candle.pha.pa.us>
To: David Wheeler <david@wheeler.net>
Cc: Bruno Wolff III <bruno@wolff.to>
Cc: pgsql-admin@postgresql.org
Subject: Re: Silencing NOTICEs in Perl Pg
Date: Thu, 29 Aug 2002 20:50:20 -0400 (EDT)
Message-ID: <200208300050.g7U0oKp11272@candle.pha.pa.us> (raw)
In-Reply-To: <7B2DC566-BBAF-11D6-B671-0003931A964A@wheeler.net>


7.3 will have client_min_message, which if set to WARNING will note show
notices.  7.3 is due out in a few months, beta starts next week.

---------------------------------------------------------------------------

David Wheeler wrote:
> On Thursday, August 29, 2002, at 01:02  PM, Bruno Wolff III wrote:
> 
> > On Thu, Aug 29, 2002 at 12:17:16 -0700,
> >   David Wheeler <david@wheeler.net> wrote:
> >> BTW, I missed the beginning of this thread, but based on the subject,
> >> I'd sure like to find out if there's a simple way to suppress NOTICEs
> >> using DBI/DBD::Pg. I've tried a number of tricks, but short of closing
> >> STDOUT and STDERR in my Perl script, I've not found a way to do it.
> >> PrintError => 0 doesn't do the trick.
> >
> > I do the following before doing anything with the database:
> > open(OLDERR, '>&STDERR');
> > close(STDERR);
> > open(STDERR, '>/dev/null');
> 
> Thanks for the suggestion. Unfortunately, that doesn't allow me to 
> filter out just the NOTICEs, and let everything else be printed. The 
> solution I've come up with, for those who are interested, is either 
> this:
> 
> open STDERR, "| perl -e 'while (<>) { print unless /^NOTICE:  / }'"
>    or die "Cannot pipe STDERR: $!\n";
> 
> Or this:
> 
> open STDERR, "| grep -v '^NOTICE:  '"
>    or die "Cannot pipe STDERR to grep\n";
> 
> The former will be more portable, since we already know we have Perl ;-)
> 
> Thanks for the help!
> 
> David
> 
> -- 
> David Wheeler                                     AIM: dwTheory
> david@wheeler.net                                 ICQ: 15726394
> http://david.wheeler.net/                      Yahoo!: dew7e
>                                                 Jabber: Theory@jabber.org
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073



view thread (21+ messages)  latest in thread

Message-ID: <200208300050.g7U0oKp11272@candle.pha.pa.us>
Permalink:  ../200208300050.g7U0oKp11272@candle.pha.pa.us/
Also on:    postgresql.org/message-id/200208300050.g7U0oKp11272@candle.pha.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: pgman@candle.pha.pa.us, david@wheeler.net, bruno@wolff.to
  Subject: Re: Silencing NOTICEs in Perl Pg
  In-Reply-To: <200208300050.g7U0oKp11272@candle.pha.pa.us>
  References: <7B2DC566-BBAF-11D6-B671-0003931A964A@wheeler.net> <200208300050.g7U0oKp11272@candle.pha.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox