From: Bryce Nesbitt <bryce2@obviously.com>
To: sql pgsql <pgsql-sql@postgresql.org>
Subject: Avoiding "will create implicit index" NOTICE
Date: Mon, 01 Jun 2009 12:32:20 -0700
Message-ID: <4A242CC4.5000400@obviously.com> (raw)
I'm looking for a good way to avoid triggering the "will create implicit
index" NOTICE that Postgres (all versions) puts out. This ends up
spamming cron scripts for no good reason:
=> create table junk_six (foo int, primary key (foo));
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
"junk_six_pkey" for table "junk_six"
CREATE TABLE
I've got a hacky solution (in perl), pulled from
http://www.perlmonks.org/index.pl/jacques?node_id=540511
which suppresses the warning:
my $tmpwarn = $SIG{__WARN__};
$SIG{__WARN__} = sub { print STDERR @_ if $_[0] !~ m/NOTICE: CREATE
TABLE/; };
$sqldb->sql_execute("create table junk_six (foo int, primary key (foo));");
$SIG{__WARN__} = $tmpwarn;
And I know that I can edit the warning level in postgresql.conf with
some other side effects.
But the best solution would be to avoid the notice in the first place.
Is this possible?
-Bryce
Keywords: postgres, warning, error, suppress, disable, avoid, hide,
stderr, stdout
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: bryce2@obviously.com
Subject: Re: Avoiding "will create implicit index" NOTICE
In-Reply-To: <4A242CC4.5000400@obviously.com>
* 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