]> granicus.if.org Git - postgresql/commitdiff
Fix minor bug in isolationtester.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 17 Oct 2018 19:06:38 +0000 (15:06 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 17 Oct 2018 19:06:38 +0000 (15:06 -0400)
If the lock wait query failed, isolationtester would report the
PQerrorMessage from some other connection, meaning there would be
no message or an unrelated one.  This seems like a pretty unlikely
occurrence, but if it did happen, this bug could make it really
difficult/confusing to figure out what happened.  That seems to
justify patching all the way back.

In passing, clean up another place where the "wrong" conn was used
for an error report.  That one's not actually buggy because it's
a different alias for the same connection, but it's still confusing
to the reader.

src/test/isolation/isolationtester.c

index 908a7ce80027ee16fa1f206b4680dd6150da90fd..4f0c8ad4a8538155c65972697e4dfb9407935db1 100644 (file)
@@ -596,7 +596,7 @@ run_permutation(TestSpec *testspec, int nsteps, Step **steps)
                if (!PQsendQuery(conn, step->sql))
                {
                        fprintf(stdout, "failed to send query for step %s: %s\n",
-                                       step->name, PQerrorMessage(conns[1 + step->session]));
+                                       step->name, PQerrorMessage(conn));
                        exit_nicely();
                }
 
@@ -745,7 +745,7 @@ try_complete_step(Step *step, int flags)
                                        PQntuples(res) != 1)
                                {
                                        fprintf(stderr, "lock wait query failed: %s",
-                                                       PQerrorMessage(conn));
+                                                       PQerrorMessage(conns[0]));
                                        exit_nicely();
                                }
                                waiting = ((PQgetvalue(res, 0, 0))[0] == 't');