Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id EB70B6333B6 for ; Mon, 1 Jun 2009 17:07:40 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 23760-03 for ; Mon, 1 Jun 2009 17:07:34 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-fx0-f222.google.com (mail-fx0-f222.google.com [209.85.220.222]) by mail.postgresql.org (Postfix) with ESMTP id 97599632F51 for ; Mon, 1 Jun 2009 17:07:37 -0300 (ADT) Received: by fxm22 with SMTP id 22so8176610fxm.19 for ; Mon, 01 Jun 2009 13:07:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=NcBrof2b2aJquk3QQyncoM6QXDdNx8RJikzLz6XgJqE=; b=R0xlzgbgQ/DCcg8li2JBpdeejumclGebP7OuXrsxq4S5MfrM+NvjkgrrEnIU6QEJ2i xEIf6J18PXcoswWcshp8ReAhUP58WqIOLWhPKSE7EAV8lJne6H21JV5AeD/w6Lu+zaWk HfB9C2l9p3a6nnPCk6pLwYxAKGgF6j162szEc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=AX3umJXKUV5I2n7DWlVGnwcWhzOgR/eH58gdl1s2cLxnyN1pbrUKR6eu4PD8jhKVj2 Jz0aQkD842rsdNrrXvXA2LaNbHL4YzTzZShOzhsN3/Yw6KFiqimLM2CJO9Pu+ZTgVVl6 DSiOQQej66eOI+VG+AXDT0BMcguJ2omEbp5T8= MIME-Version: 1.0 Received: by 10.239.156.144 with SMTP id m16mr406361hbc.133.1243886855908; Mon, 01 Jun 2009 13:07:35 -0700 (PDT) In-Reply-To: <4A242CC4.5000400@obviously.com> References: <4A242CC4.5000400@obviously.com> Date: Mon, 1 Jun 2009 14:07:35 -0600 Message-ID: Subject: Re: Avoiding "will create implicit index" NOTICE From: Scott Marlowe To: Bryce Nesbitt Cc: sql pgsql Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.014 tagged_above=0 required=5 tests=AWL=0.014 X-Spam-Level: X-Archive-Number: 200906/7 X-Sequence-Number: 32612 On Mon, Jun 1, 2009 at 1:32 PM, Bryce Nesbitt wrote: > I'm looking for a good way to avoid triggering the "will create implicit > index" NOTICE that Postgres (all versions) puts out. =A0This ends up spam= ming > cron scripts for no good reason: > > =3D> create table junk_six (foo int, primary key (foo)); > NOTICE: =A0CREATE 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 > =A0http://www.perlmonks.org/index.pl/jacques?node_id=3D540511 > which suppresses the warning: > > my $tmpwarn =3D $SIG{__WARN__}; > $SIG{__WARN__} =3D sub { print STDERR @_ if $_[0] !~ m/NOTICE: =A0CREATE = TABLE/; > }; > $sqldb->sql_execute("create table junk_six (foo int, primary key (foo));"= ); > $SIG{__WARN__} =3D $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. = =A0Is > this possible? You can also set log_min_messages by the connection, by the user, and by the database. alter user bubba set log_min_messages=3Derror; etc.