mirror of
https://github.com/postgres/postgres.git
synced 2025-06-14 18:42:34 +03:00
Improve PQtrace() output format
Transform the PQtrace output format from its ancient (and mostly useless) byte-level output format to a logical-message-level output, making it much more usable. This implementation allows the printing code to be written (as it indeed was) by looking at the protocol documentation, which gives more confidence that the three (docs, trace code and actual code) actually match. Author: 岩田 彩 (Aya Iwata) <iwata.aya@fujitsu.com> Reviewed-by: 綱川 貴之 (Takayuki Tsunakawa) <tsunakawa.takay@fujitsu.com> Reviewed-by: Kirk Jamison <k.jamison@fujitsu.com> Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: 黒田 隼人 (Hayato Kuroda) <kuroda.hayato@fujitsu.com> Reviewed-by: "Nagaura, Ryohei" <nagaura.ryohei@jp.fujitsu.com> Reviewed-by: Ryo Matsumura <matsumura.ryo@fujitsu.com> Reviewed-by: Greg Nancarrow <gregn4422@gmail.com> Reviewed-by: Jim Doty <jdoty@pivotal.io> Reviewed-by: Álvaro Herrera <alvherre@alvh.no-ip.org> Discussion: https://postgr.es/m/71E660EB361DF14299875B198D4CE5423DE3FBA4@g01jpexmbkw25
This commit is contained in:
@ -6459,12 +6459,27 @@ PGContextVisibility PQsetErrorContextVisibility(PGconn *conn, PGContextVisibilit
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Enables tracing of the client/server communication to a debugging file stream.
|
||||
Enables tracing of the client/server communication to a debugging file
|
||||
stream.
|
||||
<synopsis>
|
||||
void PQtrace(PGconn *conn, FILE *stream);
|
||||
</synopsis>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Each line consists of: an optional timestamp, a direction indicator
|
||||
(<literal>F</literal> for messages from client to server
|
||||
or <literal>B</literal> for messages from server to client),
|
||||
message length, message type, and message contents.
|
||||
Non-message contents fields (timestamp, direction, length and message type)
|
||||
are separated by a tab. Message contents are separated by a space.
|
||||
Protocol strings are enclosed in double quotes, while strings used as data
|
||||
values are enclosed in single quotes. Non-printable chars are printed as
|
||||
hexadecimal escapes.
|
||||
Further message-type-specific detail can be found in
|
||||
<xref linkend="protocol-message-formats"/>.
|
||||
</para>
|
||||
|
||||
<note>
|
||||
<para>
|
||||
On Windows, if the <application>libpq</application> library and an application are
|
||||
@ -6479,6 +6494,31 @@ void PQtrace(PGconn *conn, FILE *stream);
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="libpq-PQtraceSetFlags">
|
||||
<term><function>PQtraceSetFlags</function><indexterm><primary>PQtraceSetFlags</primary></indexterm></term>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Controls the tracing behavior of client/server communication.
|
||||
<synopsis>
|
||||
void PQtraceSetFlags(PGconn *conn, int flags);
|
||||
</synopsis>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<literal>flags</literal> contains flag bits describing the operating mode
|
||||
of tracing.
|
||||
If <literal>flags</literal> contains <literal>PQTRACE_SUPPRESS_TIMESTAMPS</literal>,
|
||||
then the timestamp is not included when printing each message.
|
||||
If <literal>flags</literal> contains <literal>PQTRACE_REGRESS_MODE</literal>,
|
||||
then some fields are redacted when printing each message, such as object
|
||||
OIDs, to make the output more convenient to use in testing frameworks.
|
||||
This function must be called after calling <function>PQtrace</function>.
|
||||
</para>
|
||||
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="libpq-PQuntrace">
|
||||
<term><function>PQuntrace</function><indexterm><primary>PQuntrace</primary></indexterm></term>
|
||||
|
||||
|
Reference in New Issue
Block a user