Re: BUG #16049: log_line_prefix=%a and log_connections -application_name missing - Mailing list pgsql-bugs

From death lock
Subject Re: BUG #16049: log_line_prefix=%a and log_connections -application_name missing
Date
Msg-id CAO5GjwGKBR5bg+T8PjrS5Q1zVqa1HuLu6e5AFL39hGtmZpbZZQ@mail.gmail.com
Whole thread Raw
In response to Re: BUG #16049: log_line_prefix=%a and log_connections - application_name missing  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #16049: log_line_prefix=%a and log_connections -application_name missing
List pgsql-bugs
Not sure where I messed up yesterday , slimmed patch in attachment

--- postgresql-9.5.19/src/backend/utils/error/elog.c
+++ postgresql-9.5.19/src/backend/utils/error/elog.c
@@ -2354,7 +2354,9 @@
    case 'a':
      if (MyProcPort)
 {
-     const char *appname = application_name;
+
+   //    ereport(LOG, (errmsg(" ++ MyProcPort : [%s] ", application_name)));
+   const char *appname = MyProcPort->application_name;

adding 'MyProcPort->' works great for me
1. why appname =application_name doesn't produce err , but trying to
print application_name value -> SegFault ?

Attachment

pgsql-bugs by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: BUG #16045: vacuum_db crash and illegal memory alloc afterpg_upgrade from PG11 to PG12
Next
From: Tom Lane
Date:
Subject: Re: BUG #16045: vacuum_db crash and illegal memory alloc after pg_upgrade from PG11 to PG12