Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id DA6A0B5DBE5 for ; Fri, 19 Aug 2011 12:12:38 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 65381-04 for ; Fri, 19 Aug 2011 15:12:32 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id B974EB5DBC1 for ; Fri, 19 Aug 2011 12:12:31 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p7JFCOTk007942; Fri, 19 Aug 2011 11:12:24 -0400 (EDT) To: "Marc Mamin" cc: pgsql-bugs@postgresql.org, Joe Conway Subject: Re: BUG #6168: db_link may generate additional unformatted log entries in stderr In-reply-to: <201108191153.p7JBr6b6080022@wwwmaster.postgresql.org> References: <201108191153.p7JBr6b6080022@wwwmaster.postgresql.org> Comments: In-reply-to "Marc Mamin" message dated "Fri, 19 Aug 2011 11:53:06 +0000" Date: Fri, 19 Aug 2011 11:12:24 -0400 Message-ID: <7941.1313766744@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-3.067 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-1.167 X-Spam-Level: X-Archive-Number: 201108/114 X-Sequence-Number: 30926 "Marc Mamin" writes: > I've stumbled on a few entries in my stderr log where the line prefix where > missing. e.g.: > 2011-08-08 13:12:16 CEST|4e3fc490.17bc|6076|foo|DETAIL: Returned type > character ... > 2011-08-08 13:12:16 CEST|4e3fc490.17bc|6076|foo|CONTEXT: PL/pgSQL > function "bm_ ... > 2011-08-08 13:12:16 CEST|4e3fc490.17bc|6076|foo|STATEMENT: Select > coalesce(colu ... > => NOTICE: table "sessions_summary_raw_20110815" does not exist, skipping > => NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index > "pk_sessions_s ... > => NOTICE: table "sessions_site_summary_raw_20110815" does not exist, > skipping > NOTICE entries should moreover not be logged ! > Those entries are coming from db_link. I guess your test case is looping back to the same Postgres instance? What I see here is that the target backend (the one connected to by dblink) logs the warning as expected, and then the dblink one also prints the warning to stderr. This is because dblink does not override either PQsetNoticeReceiver or PQsetNoticeProcessor, so libpq provides its default behavior of printing warnings/notices on stderr. It'd probably make sense for dblink to supply a notice receiver that converts the result into an ereport() call, much as it does for actual error results (in fact it could likely use dblink_res_error for that). But frankly this is an enhancement request, not a bug. The entire point of the stderr logging mechanism is to capture random printouts to stderr that might happen in code called by the backend, and it's doing exactly what it's supposed to. regards, tom lane