From: alvherre@alvh.no-ip.org <alvherre@alvh.no-ip.org>
To: tsunakawa.takay@fujitsu.com <tsunakawa.takay@fujitsu.com>
Cc: iwata.aya@fujitsu.com <iwata.aya@fujitsu.com>
Cc: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: tgl@sss.pgh.pa.us <tgl@sss.pgh.pa.us>
Cc: k.jamison@fujitsu.com <k.jamison@fujitsu.com>
Cc: pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>
Subject: Re: libpq debug log
Date: Fri, 26 Mar 2021 16:48:42 -0300
Message-ID: <20210326194842.GA30980@alvherre.pgsql> (raw)
In-Reply-To: <TYAPR01MB2990B47530DA1C761DE75E67FE689@TYAPR01MB2990.jpnprd01.prod.outlook.com>
Hello
I added an option to the new libpq_pipeline program that it activates
libpq trace. It works nicely and I think we can add that to the
regression tests. However I have two observations.
1. The trace output for the error message won't be very nice, because it
prints line numbers. So if I want to match the output to an "expected"
file, it would break every time somebody edits the source file where the
error originates and the ereport() line is moved. For example:
< 70 ErrorResponse S "ERROR" V "ERROR" C "22012" M "division by zero" F "numeric.c" L "8366" R "div_var" \x00 "Z"
The line number 8366 in this line would be problematic. I think if we
want regression testing for this, we should have another trace flag to
suppress output of a few of these fields. I would have it print only S,
C and M.
(Hey, what the heck is that "Z" at the end of the message? I thought
the error ended right at the \x00 ...)
2. The < and > characters are not good for visual inspection. I
replaced them with F and B and I think it's much clearer. Compare:
> 27 Query "SET lc_messages TO "C""
< 8 CommandComplete "SET"
< 5 ReadyForQuery I
> 21 Parse "" "SELECT $1" 1 23
> 19 Bind "" "" 0 1 1 '1' 1 0
> 6 Describe P ""
> 9 Execute "" 0
> 4 Sync
< 4 ParseComplete
< 4 BindComplete
< 33 RowDescription 1 "?column?" 0 0 23 4 -1 0
< 11 DataRow 1 1 '1'
< 13 CommandComplete "SELECT 1"
< 5 ReadyForQuery I
> 4 Terminate
with
F 27 Query "SET lc_messages TO "C""
B 8 CommandComplete "SET"
B 5 ReadyForQuery I
F 21 Parse "" "SELECT $1" 1 23
F 19 Bind "" "" 0 1 1 '1' 1 0
F 6 Describe P ""
F 9 Execute "" 0
F 4 Sync
B 4 ParseComplete
B 4 BindComplete
B 33 RowDescription 1 "?column?" 0 0 23 4 -1 0
B 11 DataRow 1 1 '1'
B 13 CommandComplete "SELECT 1"
B 5 ReadyForQuery I
F 4 Terminate
I think the second one is much easier on the eye.
(This one is the output from "libpq_pipeline simple_pipeline").
--
Álvaro Herrera Valdivia, Chile
"Saca el libro que tu religión considere como el indicado para encontrar la
oración que traiga paz a tu alma. Luego rebootea el computador
y ve si funciona" (Carlos Duclós)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: alvherre@alvh.no-ip.org, tsunakawa.takay@fujitsu.com, iwata.aya@fujitsu.com, horikyota.ntt@gmail.com, tgl@sss.pgh.pa.us, k.jamison@fujitsu.com, pgsql-hackers@lists.postgresql.org
Subject: Re: libpq debug log
In-Reply-To: <20210326194842.GA30980@alvherre.pgsql>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox