Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite7e3414

Browse files
committed
Suppress length of Notice/Error msgs in PQtrace regress mode
A (relatively minor) annoyance of ErrorResponse/NoticeResponse messagesas printed by PQtrace() is that their length might vary when we moveerror messages from one source file to another, one function to another,or even when their location line numbers change number of digits.To avoid having to adjust expected files for some tests, make theregress mode of PQtrace() suppress the length word of NoticeResponse andErrorResponse messages.Discussion:https://postgr.es/m/20210402023010.GA13563@alvherre.pgsqlReviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
1 parent846d35b commite7e3414

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

‎src/interfaces/libpq/fe-trace.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,16 @@ pqTraceOutputMessage(PGconn *conn, const char *message, bool toServer)
549549
length= (int)pg_ntoh32(length);
550550
logCursor+=4;
551551

552-
fprintf(conn->Pfdebug,"%s\t%d\t",prefix,length);
552+
/*
553+
* In regress mode, suppress the length of ErrorResponse and
554+
* NoticeResponse. The F (file name), L (line number) and R (routine
555+
* name) fields can change as server code is modified, and if their
556+
* lengths differ from the originals, that would break tests.
557+
*/
558+
if (regress&& !toServer&& (id=='E'||id=='N'))
559+
fprintf(conn->Pfdebug,"%s\tNN\t",prefix);
560+
else
561+
fprintf(conn->Pfdebug,"%s\t%d\t",prefix,length);
553562

554563
switch (id)
555564
{

‎src/test/modules/libpq_pipeline/traces/pipeline_abort.trace

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
F42Query "DROP TABLE IF EXISTS pq_pipeline_demo"
2-
B123NoticeResponse S "NOTICE" V "NOTICE" C "00000" M "table "pq_pipeline_demo" does not exist, skipping" F "SSSS" L "SSSS" R "SSSS" \x00
2+
BNNNoticeResponse S "NOTICE" V "NOTICE" C "00000" M "table "pq_pipeline_demo" does not exist, skipping" F "SSSS" L "SSSS" R "SSSS" \x00
33
B15CommandComplete "DROP TABLE"
44
B5ReadyForQuery I
55
F99Query "CREATE UNLOGGED TABLE pq_pipeline_demo(id serial primary key, itemno integer,int8filler int8);"
@@ -27,7 +27,7 @@ B4ParseComplete
2727
B4BindComplete
2828
B4NoData
2929
B15CommandComplete "INSERT 0 1"
30-
B217ErrorResponse 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
30+
BNNErrorResponse 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
3131
B5ReadyForQuery I
3232
B4ParseComplete
3333
B4BindComplete
@@ -39,7 +39,7 @@ F12Bind "" "" 0 0 0
3939
F6Describe P ""
4040
F9Execute "" 0
4141
F4Sync
42-
B123ErrorResponse S "ERROR" V "ERROR" C "42601" M "cannot insert multiple commands into a prepared statement" F "SSSS" L "SSSS" R "SSSS" \x00
42+
BNNErrorResponse S "ERROR" V "ERROR" C "42601" M "cannot insert multiple commands into a prepared statement" F "SSSS" L "SSSS" R "SSSS" \x00
4343
B5ReadyForQuery I
4444
F54Parse "" "SELECT 1.0/g FROM generate_series(3, -1, -1) g" 0
4545
F12Bind "" "" 0 0 0
@@ -52,7 +52,7 @@ B33RowDescription 1 "?column?" NNNN 0 NNNN 65535 -1 0
5252
B32DataRow 1 22 '0.33333333333333333333'
5353
B32DataRow 1 22 '0.50000000000000000000'
5454
B32DataRow 1 22 '1.00000000000000000000'
55-
B70ErrorResponse S "ERROR" V "ERROR" C "22012" M "division by zero" F "SSSS" L "SSSS" R "SSSS" \x00
55+
BNNErrorResponse S "ERROR" V "ERROR" C "22012" M "division by zero" F "SSSS" L "SSSS" R "SSSS" \x00
5656
B5ReadyForQuery I
5757
F40Query "SELECT itemno FROM pq_pipeline_demo"
5858
B31RowDescription 1 "itemno" NNNN 2 NNNN 4 -1 0

‎src/test/modules/libpq_pipeline/traces/transaction.trace

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
F79Query "DROP TABLE IF EXISTS pq_pipeline_tst;CREATE TABLE pq_pipeline_tst (id int)"
2-
B122NoticeResponse S "NOTICE" V "NOTICE" C "00000" M "table "pq_pipeline_tst" does not exist, skipping" F "SSSS" L "SSSS" R "SSSS" \x00
2+
BNNNoticeResponse S "NOTICE" V "NOTICE" C "00000" M "table "pq_pipeline_tst" does not exist, skipping" F "SSSS" L "SSSS" R "SSSS" \x00
33
B15CommandComplete "DROP TABLE"
44
B17CommandComplete "CREATE TABLE"
55
B5ReadyForQuery I
@@ -40,9 +40,9 @@ B4BindComplete
4040
B4NoData
4141
B10CommandComplete "BEGIN"
4242
B4ParseComplete
43-
B65ErrorResponse S "ERROR" V "ERROR" C "22012" M "division by zero" F "SSSS" L "SSSS" R "SSSS" \x00
43+
BNNErrorResponse S "ERROR" V "ERROR" C "22012" M "division by zero" F "SSSS" L "SSSS" R "SSSS" \x00
4444
B5ReadyForQuery E
45-
B145ErrorResponse 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
45+
BNNErrorResponse 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
4646
B5ReadyForQuery E
4747
B4BindComplete
4848
B4NoData

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp