On Wed, Dec 11, 2013 at 8:31 PM, MauMau <maumau307@gmail.com> wrote:
>>> From: "Amit Kapila" <amit.kapila16@gmail.com>
>
> I re-considered that. As you suggested, I think I'll do as follows. Would
> this be OK?
>
> [pg_ctl.c]
> evtHandle = RegisterEventSource(NULL, *event_source ? event_source :
> "PostgreSQL " PG_MAJORVERSION);
>
>
> [guc.c]
> {"event_source", PGC_POSTMASTER, LOGGING_WHERE,
> ...
> "PostgreSQL " PG_MAJORVERSION,
> NULL, NULL, NULL
This is similar to what I had in mind.
>
> [elog.c]
> Writing the default value in this file was redundant, because event_source
> cannot be NULL. So change
>
>
> evtHandle = RegisterEventSource(NULL, event_source ? event_source :
> "PostgreSQL");
>
> to
>
> evtHandle = RegisterEventSource(NULL, event_source);
I think this change might not be safe as write_eventlog() gets called
from write_stderr() which might get called
before reading postgresql.conf, so the code as exists in PG might be
to handle that case or some other similar
situation where event_source is still not set. Have you confirmed in
all ways that it is never the case that
event_source is not set when the control reaches this function.
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com