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

Commit677fde0

Browse files
committed
Minor robustness improvements for isolationtester.
Notice and complain about PQcancel() failures. Also, don't dump core ifan error PGresult doesn't contain severity and message subfields, as itmight not if it was generated by libpq itself. (We have a longstandingTODO item to improve that, but in the meantime isolationtester had bettercope.)I tripped across the latter item while investigating a trouble report onbuildfarm member spoonbill. As for the former, there's no evidence thatPQcancel failure is actually involved in spoonbill's problem, but it stillseems like a bad idea to ignore an error return code.
1 parent114fca5 commit677fde0

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

‎src/test/isolation/isolationtester.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,22 @@ run_permutation(TestSpec * testspec, int nsteps, Step ** steps)
311311
break;
312312

313313
casePGRES_FATAL_ERROR:
314-
/* Detail may contain xid values, so just show primary. */
315-
printf("%s: %s\n",PQresultErrorField(res,PG_DIAG_SEVERITY),
316-
PQresultErrorField(res,PG_DIAG_MESSAGE_PRIMARY));
314+
/*
315+
* Detail may contain XID values, so we want to just show
316+
* primary. Beware however that libpq-generated error results
317+
* may not contain subfields, only an old-style message.
318+
*/
319+
{
320+
constchar*sev=PQresultErrorField(res,
321+
PG_DIAG_SEVERITY);
322+
constchar*msg=PQresultErrorField(res,
323+
PG_DIAG_MESSAGE_PRIMARY);
324+
325+
if (sev&&msg)
326+
printf("%s: %s\n",sev,msg);
327+
else
328+
printf("%s",PQresultErrorMessage(res));
329+
}
317330
break;
318331

319332
default:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp