Skip to content

Commit db01f79

Browse files
committed
Fix interaction of log_line_prefix's query_id and log_statement
log_statement is issued before query_id can be computed, so properly clear the value, and document the interaction. Reported-by: Fujii Masao, Michael Paquier Discussion: https://postgr.es/m/YHPkU8hFi4no4NSw@paquier.xyz Author: Julien Rouhaud
1 parent 9660834 commit db01f79

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

doc/src/sgml/config.sgml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7139,6 +7139,16 @@ log_line_prefix = '%m [%p] %q%u@%d/%a '
71397139
</programlisting>
71407140
</para>
71417141
</tip>
7142+
7143+
<note>
7144+
<para>
7145+
The <literal>%Q</literal> escape always reports a zero identifier
7146+
for lines output by <xref linkend="guc-log-statement"/> because
7147+
<varname>log_statement</varname> generates output before an
7148+
identifier can be calculated, including invalid statements for
7149+
which an identifier cannot be calculated.
7150+
</para>
7151+
</note>
71427152
</listitem>
71437153
</varlistentry>
71447154

src/backend/utils/activity/backend_status.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ pgstat_bestart(void)
398398
lbeentry.st_state = STATE_UNDEFINED;
399399
lbeentry.st_progress_command = PROGRESS_COMMAND_INVALID;
400400
lbeentry.st_progress_command_target = InvalidOid;
401+
lbeentry.st_query_id = UINT64CONST(0);
401402

402403
/*
403404
* we don't zero st_progress_param here to save cycles; nobody should

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy