Re: Multiple hosts in connection string failed to failover in non-hot standby mode

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: Hubert Zhang <zhubert(at)vmware(dot)com>, tsunakawa(dot)takay(at)fujitsu(dot)com, pgsql-hackers(at)postgresql(dot)org, Andreas Seltenreich <seltenreich(at)gmx(dot)de>, Bruce Momjian <bruce(at)momjian(dot)us>
Subject: Re: Multiple hosts in connection string failed to failover in non-hot standby mode
Date: 2021-05-06 17:22:27
Message-ID: 4170264.1620321747@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Justin Pryzby <pryzby(at)telsasoft(dot)com> writes:
> 52a10224 broke sqlsmith, of all things.

> It was using errmsg as a test of success, instead of checking if the connection
> result wasn't null:

> conn = PQconnectdb(conninfo.c_str());
> char *errmsg = PQerrorMessage(conn);
> if (strlen(errmsg))
> throw dut::broken(errmsg, "08001");

> That's clearly the wrong thing to do, but maybe this should be described in the
> release notes as a compatibility issue, in case other people had the same idea.
> Clearing errorMessage during success is an option..

Hm. I'd debated whether to clear conn->errorMessage at the end of
a successful connection sequence, and decided not to on the grounds
that it might be interesting info (eg it could tell you why you
ended up connected to server Y and not server X). But perhaps
it's too much of a compatibility break for this small benefit.

I'm curious though why it took this long for anyone to complain.
I'd supposed that people were running sqlsmith against HEAD on
a pretty regular basis.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Álvaro Herrera 2021-05-06 17:32:08 Re: ALTER TABLE .. DETACH PARTITION CONCURRENTLY
Previous Message Álvaro Herrera 2021-05-06 17:13:47 Re: ALTER TABLE .. DETACH PARTITION CONCURRENTLY