Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id AE346632F51 for ; Mon, 1 Jun 2009 16:39:15 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 14589-02 for ; Mon, 1 Jun 2009 16:39:13 -0300 (ADT) X-Greylist: delayed 00:06:38.954537 by SQLgrey-1.7.6 Received: from mail6.sea5.speakeasy.net (mail6.sea5.speakeasy.net [69.17.117.8]) by mail.postgresql.org (Postfix) with ESMTP id D21D96346A8 for ; Mon, 1 Jun 2009 16:39:03 -0300 (ADT) Received: (qmail 1156 invoked from network); 1 Jun 2009 19:32:21 -0000 Received: from dsl081-048-173.sfo1.dsl.speakeasy.net (HELO xena.bepress.com) ([64.81.48.173]) (envelope-sender ) by mail6.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 1 Jun 2009 19:32:21 -0000 Received: from [192.168.1.146] (unknown [192.168.1.146]) by xena.bepress.com (Postfix) with ESMTP id C7CDC73585 for ; Mon, 1 Jun 2009 12:32:20 -0700 (PDT) Message-ID: <4A242CC4.5000400@obviously.com> Date: Mon, 01 Jun 2009 12:32:20 -0700 From: Bryce Nesbitt User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.21) Gecko/20090303 SeaMonkey/1.1.15 (Ubuntu-1.1.15+nobinonly-0ubuntu0.8.04.2) MIME-Version: 1.0 To: sql pgsql Subject: Avoiding "will create implicit index" NOTICE Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200906/6 X-Sequence-Number: 32611 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