Content-Length: 298327 | pFad | http://github.com/postgrespro/postgres/commit/db01f797dd48f826c62e1b8eea70f11fe7ff3efc

86 Fix interaction of log_line_prefix's query_id and log_statement · postgrespro/postgres@db01f79 · GitHub
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)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/db01f797dd48f826c62e1b8eea70f11fe7ff3efc

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy