Re: Reporting hba lines - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Reporting hba lines
Date
Msg-id 29678.1340806473@sss.pgh.pa.us
Whole thread Raw
In response to Re: Reporting hba lines  (Magnus Hagander <magnus@hagander.net>)
Responses Re: Reporting hba lines
List pgsql-hackers
Magnus Hagander <magnus@hagander.net> writes:
> On Wed, Jun 27, 2012 at 3:55 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> BTW, are you sure that auth_failed is only called in cases where
>> an hba line has already been identified?  Even if true today,
>> it seems fairly risky to assume that.

> It is true today, but yes, it might be safe to guard against it with
> something like this?

FWIW, the usual approach for conditionally emitting bits of an ereport
is more like
ereport(FATAL,    (errcode(errcode_return),     errmsg(errstr, port->user_name),     port->hba ?
errdetail_log("Connectionmatched pg_hba.conf line %d", port->hba->linenumber) : 0));
 

but that's just a nitpick.  A bigger issue is that I'm not convinced
that a line number will be tremendously helpful: it's easy to miscount
lines, and a line number will certainly not be helpful in the frequent
cases where people are modifying the wrong hba file.  Can we show
the source text of the hba line?
        regards, tom lane


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: warning handling in Perl scripts
Next
From: Amit Kapila
Date:
Subject: Regarding WAL Format Changes