aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2021-04-07 22:30:30 -0400
committerBruce Momjian <bruce@momjian.us>2021-04-07 22:30:30 -0400
commitf57a2f5e03054ade221e554c70e628e1ffae1b66 (patch)
tree2cfea556bf5905c55e13d79be4568edd2fc83030 /src
parent5100010ee4d5c8ef46619dbd1d17090c627e6d0a (diff)
downloadpostgresql-f57a2f5e03054ade221e554c70e628e1ffae1b66.tar.gz
postgresql-f57a2f5e03054ade221e554c70e628e1ffae1b66.zip
Add csvlog output for the new query_id value
This also adjusts the printf format for query id used by log_line_prefix (%Q). Reported-by: Justin Pryzby Discussion: https://postgr.es/m/20210408005402.GG24239@momjian.us Author: Julien Rouhaud, Bruce Momjian
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/error/elog.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index 1cf71a649b3..a1ebe06d5b0 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -2716,11 +2716,11 @@ log_line_prefix(StringInfo buf, ErrorData *edata)
break;
case 'Q':
if (padding != 0)
- appendStringInfo(buf, "%*ld", padding,
- pgstat_get_my_queryid());
+ appendStringInfo(buf, "%*lld", padding,
+ (long long) pgstat_get_my_queryid());
else
- appendStringInfo(buf, "%ld",
- pgstat_get_my_queryid());
+ appendStringInfo(buf, "%lld",
+ (long long) pgstat_get_my_queryid());
break;
default:
/* format error - ignore it */
@@ -2964,6 +2964,10 @@ write_csvlog(ErrorData *edata)
if (leader && leader->pid != MyProcPid)
appendStringInfo(&buf, "%d", leader->pid);
}
+ appendStringInfoChar(&buf, ',');
+
+ /* query id */
+ appendStringInfo(&buf, "%lld", (long long) pgstat_get_my_queryid());
appendStringInfoChar(&buf, '\n');