On Thu, Jan 26, 2017 at 2:32 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> The way I'd be inclined to make the individual reporting changes is like
>
> if (!EnableSSL)
> + {
> - ereport(LOG,
> + ereport(elevel,
> (errcode(ERRCODE_CONFIG_FILE_ERROR),
> errmsg("hostssl record cannot match because SSL is disabled"),
> errhint("Set ssl = on in postgresql.conf."),
> errcontext("line %d of configuration file \"%s\"",
> line_num, HbaFileName)));
> + *err_msg = pstrdup("hostssl record cannot match because SSL is disabled");
> + }
>
> which is considerably less invasive and hence easier to review, and
> supports reporting different text in the view than appears in the log,
> should we need that. It seems likely also that we could drop the pstrdup
> in the case of constant strings (we'd still need psprintf if we want to
> insert values into the view messages), which would make this way cheaper
> than what's in the patch now.
I don't really understand the argument about readability of the patch
as what Haribabu has proposed is simply to avoid a duplicate of the
strings and the diffs of the patch are really clear. For the sake of
not translating the strings sent back to the system view though I can
buy it.
--
Michael