Re: BUG #6168: db_link may generate additional unformatted log entries in stderr

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Marc Mamin" <marc(at)intershop(dot)de>
Cc: pgsql-bugs(at)postgresql(dot)org, Joe Conway <mail(at)joeconway(dot)com>
Subject: Re: BUG #6168: db_link may generate additional unformatted log entries in stderr
Date: 2011-08-19 15:12:24
Message-ID: 7941.1313766744@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Marc Mamin" <marc(at)intershop(dot)de> 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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Marc Mamin 2011-08-19 15:47:14 Re: BUG #6168: db_link may generate additional unformatted log entries in stderr
Previous Message ondro 2011-08-19 13:19:28 BUG #6169: a non fatal error occured during cluster.... problem with environment variables