diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 7b3e617947..d750f0800b 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -4089,14 +4089,14 @@ local0.* /var/log/postgresql The %c escape prints a quasi-unique session identifier, - consisting of two 4-byte hexadecimal numbers separated by a dot. - The numbers are the process start time and the + consisting of two 4-byte hexadecimal numbers (without leading zeros) + separated by a dot. The numbers are the process start time and the process ID, so %c can also be used as a space saving way of printing those items. For example, to generate the session identifier from pg_stat_activity, use this query: SELECT to_hex(EXTRACT(EPOCH FROM backend_start)::integer) || '.' || - regexp_replace('0000' || '0133e3', '^0*(.{4,})$', '\1') + to_hex(pid) FROM pg_stat_activity; diff --git a/doc/src/sgml/release-9.3.sgml b/doc/src/sgml/release-9.3.sgml index 32839b7d2f..d64e8e357f 100644 --- a/doc/src/sgml/release-9.3.sgml +++ b/doc/src/sgml/release-9.3.sgml @@ -78,14 +78,6 @@ - - - Have session id (%c) in log_line_prefix - always output at least four hex digits after the period (Bruce Momjian) - - - diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index 3a211bf4cd..f8cf190e65 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -2087,7 +2087,7 @@ log_line_prefix(StringInfo buf, ErrorData *edata) } break; case 'c': - appendStringInfo(buf, "%lx.%04x", (long) (MyStartTime), MyProcPid); + appendStringInfo(buf, "%lx.%x", (long) (MyStartTime), MyProcPid); break; case 'p': appendStringInfo(buf, "%d", MyProcPid); @@ -2266,7 +2266,7 @@ write_csvlog(ErrorData *edata) appendStringInfoChar(&buf, ','); /* session id */ - appendStringInfo(&buf, "%lx.%04x", (long) MyStartTime, MyProcPid); + appendStringInfo(&buf, "%lx.%x", (long) MyStartTime, MyProcPid); appendStringInfoChar(&buf, ','); /* Line number */