When outputting the session id in log_line_prefix (%c) or in CSV log
authorBruce Momjian <bruce@momjian.us>
Tue, 16 Oct 2012 16:37:59 +0000 (12:37 -0400)
committerBruce Momjian <bruce@momjian.us>
Tue, 16 Oct 2012 16:37:59 +0000 (12:37 -0400)
output mode, cause the hex digits after the period to always be at least
four hex digits, with zero-padding.

src/backend/utils/error/elog.c

index a40b343ebcfb478515659bc52d84ecccd8ca97a5..68b7ab3f5fbae8b76765b9370f1c5f5d1731aa91 100644 (file)
@@ -1970,7 +1970,7 @@ log_line_prefix(StringInfo buf, ErrorData *edata)
                }
                break;
            case 'c':
-               appendStringInfo(buf, "%lx.%x", (long) (MyStartTime), MyProcPid);
+               appendStringInfo(buf, "%lx.%04x", (long) (MyStartTime), MyProcPid);
                break;
            case 'p':
                appendStringInfo(buf, "%d", MyProcPid);
@@ -2149,7 +2149,7 @@ write_csvlog(ErrorData *edata)
    appendStringInfoChar(&buf, ',');
 
    /* session id */
-   appendStringInfo(&buf, "%lx.%x", (long) MyStartTime, MyProcPid);
+   appendStringInfo(&buf, "%lx.%04x", (long) MyStartTime, MyProcPid);
    appendStringInfoChar(&buf, ',');
 
    /* Line number */