Re: libpq should append auth failures, not overwrite

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: libpq should append auth failures, not overwrite
Date: 2018-08-15 15:53:27
Message-ID: 9954.1534348407@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Thu, Aug 9, 2018 at 11:44 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> So I think we should basically s/printfPQExpBuffer/appendPQExpBuffer/g
>> anywhere those files touch conn->errorMessage, allowing any problems
>> with previous servers to be preserved in the eventually-reported message.

> I guess the question in my mind is what behavior is most useful for
> users. There are, I'm sure, cases where it's useful to see all the
> details you are proposing to print. But it also seems like there
> could be a significant number of cases where it's really more than
> anybody wants to know. For instance, if I try to connect
> host=primary1,primary2,dr and primary1 is offline right now, because
> we're using primary2, and if it happens that I mistype my password,
> with your patch, I'll get an error saying that primary1 is down,
> followed by an error about my password. I only care about the second
> one. If I had typed my password correctly, I would have just gotten a
> connection, and everything would have been fine. Telling me that
> primary1 is down may make me (1) panic or (2) miss the real cause of
> my problem.

> So I'm not as convinced as you are that always displaying maximum
> detail is really the right thing to do.

Well, I'm actually not proposing to print "maximum detail", and Fabien
is complaining about that, which makes me think maybe I've hit a happy
medium ;-). In particular, the proposed patches won't change behavior
for cases where you just give one hostname or hostaddr, and I'd argue
that that is the only case where we really have enough track record to
be sure that people are happy with the amount of detail provided.
As soon as you have multiple target hosts, though, the current code's
behavior is inadequate IMO. Indisputably it's inconsistent, because
some code paths will concatenate error messages and some won't, without
any rhyme or reason that I can detect. I think the only reason we've
not had more complaints is that hardly anyone is using this feature yet.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2018-08-15 15:56:20 Re: libpq should append auth failures, not overwrite
Previous Message Andres Freund 2018-08-15 15:52:37 Re: C99 compliance for src/port/snprintf.c