in reply to How to suppress notices using PostgreSQL with DBI

You can set $dbh->{Warn} to 0 while executing the table creation statements. This has the drawback that other (possibly important) database error messages are also suppressed. So a better strategy can be do redefine $SIG{__WARN__} to only suppress specific warnings:

my $tmpwarn = $SIG{__WARN__}; $SIG{__WARN__} = sub { print STDERR @_ if $_[0] !~ m/NOTICE: CREATE TABLE/; }; $sth->execute(); $SIG{__WARN__} = $tmpwarn;

Or another option would of course be to redirect STDERR to a log file entirely.


All dogma is stupid.