This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.
Subject: PATCH: Silencing DBD::Pg NOTICE messages From: Honza Pazdziora <adelton@informatics.muni.cz> Date: Wed, 16 Aug 2000 17:21:22 +0200 Hello, the DBD::Pg 0.95 emits quite a lot of disturbing messages like NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'mytable_pkey' for table 'mytable' that cannot be silenced in any way (well, I've searched the archives of dbi and pg mailing lists and the sources but didn't find anything that the user could do). The following patch shuts these messages down immediately after connect. I believe that this is what most people would like to have anyway. Next step could be to either have environment variable or attribute to rule the behaviour. In case of the attribute, we could either use PrintError pro that or set up something completely new (like pg_notice_on) with default being 0. I'd welcome your opinion. Especialy the NOTICEs about primary keys seem rather stupid to me since there is no other way of creating the primary key. Yours, -- ------------------------------------------------------------------------ Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/ .project: Perl, DBI, Oracle, MySQL, auth. WWW servers, MTB, Spain, ... ------------------------------------------------------------------------ --- dbdimp.c.orig Wed Aug 16 17:06:10 2000 +++ dbdimp.c Wed Aug 16 17:06:15 2000 @@ -109,6 +109,12 @@ return 0; } +static void +emptyNoticeProcessor(void * arg, const char * message) +{ + /* fprintf(stderr, "%s", message); */ +} + /* ================================================================== */ @@ -171,6 +177,8 @@ return 0; } + PQsetNoticeProcessor(imp_dbh->conn, emptyNoticeProcessor, NULL); + imp_dbh->init_commit = 1; /* initialize AutoCommit */ imp_dbh->pg_auto_escape = 1; /* initialize pg_auto_escape */ @@ -178,7 +186,6 @@ DBIc_ACTIVE_on(imp_dbh); /* call disconnect before freeing */ return 1; } - int dbd_db_ping (dbh) ====