From: | Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com> |
---|---|
To: | Bryce Nesbitt <bryce2(at)obviously(dot)com> |
Cc: | sql pgsql <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Avoiding "will create implicit index" NOTICE |
Date: | 2009-06-01 20:07:35 |
Message-ID: | dcc563d10906011307x3ebad394x73bfe6f13bc7d84e@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Mon, Jun 1, 2009 at 1:32 PM, Bryce Nesbitt <bryce2(at)obviously(dot)com> wrote:
> 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?
You can also set log_min_messages by the connection, by the user, and
by the database.
alter user bubba set log_min_messages=error;
etc.
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2009-06-02 20:28:58 | Re: [SQL] proposal for a CookBook in postgresql.org |
Previous Message | Bryce Nesbitt | 2009-06-01 19:32:20 | Avoiding "will create implicit index" NOTICE |