Hi, Amit san,
From: "Amit Kapila" <amit.kapila16@gmail.com>
>> [elog.c]
>> Writing the default value in this file was redundant, because
>> event_source
>> cannot be NULL. So change
>>
> 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.
Yes, you are right. I considered this again after replying to your previous
mail, and found out write_stderr() calls write_eventlog(). In that case,
event_source is still NULL before GUC initialization.
Please find attached the patch.
I put the default event source name in one place -- pg_config_manual.h,
which seems the best place. This could eliminate duplicate default values
in four places: pgevent.c, pg_ctl.c, elog.c, and guc.c. Thanks to your
review and comment, the code got cleaner and correct. Thank you very much.
Regards
MauMau