Re: pg_hba_file_settings view patch

Michael Paquier <michael.paquier@gmail.com>

From: Michael Paquier <michael.paquier@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>, Haribabu Kommi <kommi.haribabu@gmail.com>, Simon Riggs <simon@2ndquadrant.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2017-01-26T02:17:41Z
Lists: pgsql-hackers
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


Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Invent pg_hba_file_rules view to show the content of pg_hba.conf.

  2. Restructure hba.c to replace 3 parallel lists with single list of structs.