From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: iwata.aya@fujitsu.com
Cc: tgl@sss.pgh.pa.us
Cc: tsunakawa.takay@fujitsu.com
Cc: k.jamison@fujitsu.com
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: libpq debug log
Date: Fri, 2 Apr 2021 10:52:18 -0300
Message-ID: <20210402135218.GA13909@alvherre.pgsql> (raw)
In-Reply-To: <20210402123650.GA23627@alvherre.pgsql>
On 2021-Apr-02, Alvaro Herrera wrote:
> On 2021-Apr-02, Kyotaro Horiguchi wrote:
>
> > At Fri, 02 Apr 2021 14:40:09 +0900 (JST), Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote in
>
> > > So, the cheapest measure for regression test would be just making the
> >
> > So, the cheapest measure for regression test would be just *masking* the
> >
> > > length field, while regress is true...
>
> Yeah.
As in the attached patch.
--
Álvaro Herrera Valdivia, Chile
"Investigación es lo que hago cuando no sé lo que estoy haciendo"
(Wernher von Braun)
Attachments:
[text/x-diff] 0001-Suppress-length-of-Notice-Error-in-PQtrace-regress-m.patch (5.1K, ../20210402135218.GA13909@alvherre.pgsql/2-0001-Suppress-length-of-Notice-Error-in-PQtrace-regress-m.patch)
download | inline diff:
From 387a15ec80cfcdd2279b109215b9f658bc972748 Mon Sep 17 00:00:00 2001
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: Fri, 2 Apr 2021 10:51:42 -0300
Subject: [PATCH] Suppress length of Notice/Error in PQtrace regress mode
---
src/interfaces/libpq/fe-trace.c | 9 ++++++++-
.../modules/libpq_pipeline/traces/pipeline_abort.trace | 8 ++++----
src/test/modules/libpq_pipeline/traces/transaction.trace | 6 +++---
3 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/src/interfaces/libpq/fe-trace.c b/src/interfaces/libpq/fe-trace.cindex 9a4595f5c8..298713c602 100644--- a/src/interfaces/libpq/fe-trace.c+++ b/src/interfaces/libpq/fe-trace.c@@ -540,7 +540,14 @@ pqTraceOutputMessage(PGconn *conn, const char *message, bool toServer)
length = (int) pg_ntoh32(length);
logCursor += 4;
- fprintf(conn->Pfdebug, "%s\t%d\t", prefix, length);+ /*+ * In regress mode, suppress the length of ErrorResponse and+ * NoticeResponse -- they vary depending on compiler.+ */+ if (regress && !toServer && (id == 'E' || id == 'N'))+ fprintf(conn->Pfdebug, "%s\tNN\t", prefix);+ else+ fprintf(conn->Pfdebug, "%s\t%d\t", prefix, length);
switch (id)
{
diff --git a/src/test/modules/libpq_pipeline/traces/pipeline_abort.trace b/src/test/modules/libpq_pipeline/traces/pipeline_abort.traceindex b061435785..254e485997 100644--- a/src/test/modules/libpq_pipeline/traces/pipeline_abort.trace+++ b/src/test/modules/libpq_pipeline/traces/pipeline_abort.trace@@ -1,5 +1,5 @@
F 42 Query "DROP TABLE IF EXISTS pq_pipeline_demo"
-B 123 NoticeResponse S "NOTICE" V "NOTICE" C "00000" M "table "pq_pipeline_demo" does not exist, skipping" F "SSSS" L "SSSS" R "SSSS" \x00+B NN NoticeResponse S "NOTICE" V "NOTICE" C "00000" M "table "pq_pipeline_demo" does not exist, skipping" F "SSSS" L "SSSS" R "SSSS" \x00
B 15 CommandComplete "DROP TABLE"
B 5 ReadyForQuery I
F 99 Query "CREATE UNLOGGED TABLE pq_pipeline_demo(id serial primary key, itemno integer,int8filler int8);"
@@ -27,7 +27,7 @@ B 4 ParseComplete
B 4 BindComplete
B 4 NoData
B 15 CommandComplete "INSERT 0 1"
-B 217 ErrorResponse S "ERROR" V "ERROR" C "42883" M "function no_such_function(integer) does not exist" H "No function matches the given name and argument types. You might need to add explicit type casts." P "8" F "SSSS" L "SSSS" R "SSSS" \x00+B NN ErrorResponse S "ERROR" V "ERROR" C "42883" M "function no_such_function(integer) does not exist" H "No function matches the given name and argument types. You might need to add explicit type casts." P "8" F "SSSS" L "SSSS" R "SSSS" \x00
B 5 ReadyForQuery I
B 4 ParseComplete
B 4 BindComplete
@@ -39,7 +39,7 @@ F 12 Bind "" "" 0 0 0
F 6 Describe P ""
F 9 Execute "" 0
F 4 Sync
-B 123 ErrorResponse S "ERROR" V "ERROR" C "42601" M "cannot insert multiple commands into a prepared statement" F "SSSS" L "SSSS" R "SSSS" \x00+B NN ErrorResponse S "ERROR" V "ERROR" C "42601" M "cannot insert multiple commands into a prepared statement" F "SSSS" L "SSSS" R "SSSS" \x00
B 5 ReadyForQuery I
F 54 Parse "" "SELECT 1.0/g FROM generate_series(3, -1, -1) g" 0
F 12 Bind "" "" 0 0 0
@@ -52,7 +52,7 @@ B 33 RowDescription 1 "?column?" NNNN 0 NNNN 65535 -1 0
B 32 DataRow 1 22 '0.33333333333333333333'
B 32 DataRow 1 22 '0.50000000000000000000'
B 32 DataRow 1 22 '1.00000000000000000000'
-B 70 ErrorResponse S "ERROR" V "ERROR" C "22012" M "division by zero" F "SSSS" L "SSSS" R "SSSS" \x00+B NN ErrorResponse S "ERROR" V "ERROR" C "22012" M "division by zero" F "SSSS" L "SSSS" R "SSSS" \x00
B 5 ReadyForQuery I
F 40 Query "SELECT itemno FROM pq_pipeline_demo"
B 31 RowDescription 1 "itemno" NNNN 2 NNNN 4 -1 0
diff --git a/src/test/modules/libpq_pipeline/traces/transaction.trace b/src/test/modules/libpq_pipeline/traces/transaction.traceindex 0267a534fa..1dcc2373c0 100644--- a/src/test/modules/libpq_pipeline/traces/transaction.trace+++ b/src/test/modules/libpq_pipeline/traces/transaction.trace@@ -1,5 +1,5 @@
F 79 Query "DROP TABLE IF EXISTS pq_pipeline_tst;CREATE TABLE pq_pipeline_tst (id int)"
-B 122 NoticeResponse S "NOTICE" V "NOTICE" C "00000" M "table "pq_pipeline_tst" does not exist, skipping" F "SSSS" L "SSSS" R "SSSS" \x00+B NN NoticeResponse S "NOTICE" V "NOTICE" C "00000" M "table "pq_pipeline_tst" does not exist, skipping" F "SSSS" L "SSSS" R "SSSS" \x00
B 15 CommandComplete "DROP TABLE"
B 17 CommandComplete "CREATE TABLE"
B 5 ReadyForQuery I
@@ -40,9 +40,9 @@ B 4 BindComplete
B 4 NoData
B 10 CommandComplete "BEGIN"
B 4 ParseComplete
-B 65 ErrorResponse S "ERROR" V "ERROR" C "22012" M "division by zero" F "SSSS" L "SSSS" R "SSSS" \x00+B NN ErrorResponse S "ERROR" V "ERROR" C "22012" M "division by zero" F "SSSS" L "SSSS" R "SSSS" \x00
B 5 ReadyForQuery E
-B 145 ErrorResponse S "ERROR" V "ERROR" C "25P02" M "current transaction is aborted, commands ignored until end of transaction block" F "SSSS" L "SSSS" R "SSSS" \x00+B NN ErrorResponse S "ERROR" V "ERROR" C "25P02" M "current transaction is aborted, commands ignored until end of transaction block" F "SSSS" L "SSSS" R "SSSS" \x00
B 5 ReadyForQuery E
B 4 BindComplete
B 4 NoData
--
2.20.1
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, horikyota.ntt@gmail.com, iwata.aya@fujitsu.com, tgl@sss.pgh.pa.us, tsunakawa.takay@fujitsu.com, k.jamison@fujitsu.com, pgsql-hackers@lists.postgresql.org
Subject: Re: libpq debug log
In-Reply-To: <20210402135218.GA13909@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