diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2013-04-02 21:15:50 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2013-04-02 21:15:50 -0400 |
commit | 677fde06afd23f355e3d599eedc3ba7a66ef4e85 (patch) | |
tree | 0cc39e6631efcb3a979c11006ef6a070641a3166 /src/test/isolation/isolationtester.c | |
parent | 114fca526e4f843d17f9a052f81f580d9d006ef1 (diff) | |
download | postgresql-677fde06afd23f355e3d599eedc3ba7a66ef4e85.tar.gz postgresql-677fde06afd23f355e3d599eedc3ba7a66ef4e85.zip |
Minor robustness improvements for isolationtester.
Notice and complain about PQcancel() failures. Also, don't dump core if
an error PGresult doesn't contain severity and message subfields, as it
might not if it was generated by libpq itself. (We have a longstanding
TODO item to improve that, but in the meantime isolationtester had better
cope.)
I tripped across the latter item while investigating a trouble report on
buildfarm member spoonbill. As for the former, there's no evidence that
PQcancel failure is actually involved in spoonbill's problem, but it still
seems like a bad idea to ignore an error return code.
Diffstat (limited to 'src/test/isolation/isolationtester.c')
-rw-r--r-- | src/test/isolation/isolationtester.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/test/isolation/isolationtester.c b/src/test/isolation/isolationtester.c index 1d76f2cd088..ede12d57711 100644 --- a/src/test/isolation/isolationtester.c +++ b/src/test/isolation/isolationtester.c @@ -311,9 +311,22 @@ run_permutation(TestSpec * testspec, int nsteps, Step ** steps) break; case PGRES_FATAL_ERROR: - /* Detail may contain xid values, so just show primary. */ - printf("%s: %s\n", PQresultErrorField(res, PG_DIAG_SEVERITY), - PQresultErrorField(res, PG_DIAG_MESSAGE_PRIMARY)); + /* + * Detail may contain XID values, so we want to just show + * primary. Beware however that libpq-generated error results + * may not contain subfields, only an old-style message. + */ + { + const char *sev = PQresultErrorField(res, + PG_DIAG_SEVERITY); + const char *msg = PQresultErrorField(res, + PG_DIAG_MESSAGE_PRIMARY); + + if (sev && msg) + printf("%s: %s\n", sev, msg); + else + printf("%s", PQresultErrorMessage(res)); + } break; default: |