Re: pg_hba_lookup function to get all matching pg_hba.conf entries

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_hba_lookup function to get all matching pg_hba.conf entries
Date: 2015-12-03 21:05:03
Message-ID: 20151203210503.GS2763@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> >> Here I attached the patch with the suggested changes.
> >> Along with line number, I kept the options column also with authentication
> >> options as a jsonb datatype.
> >>
> >> Example output:
> >>
> >> postgres=# select pg_hba_lookup('test','all','::1');
> >> NOTICE: Skipped 84 Hba line, because of non matching IP.
> >> NOTICE: Skipped 86 Hba line, because of non matching database.
> >> NOTICE: Skipped 87 Hba line, because of non matching role.
> >> pg_hba_lookup
> >> ---------------
> >> (89,trust,{})
> >> (1 row)
> >>
> >> comments?

I don't like this interface. It's nice for psql, but everybody else is
going to lose. I think these should be reported in the SRF result set
as well; perhaps add a "mode" column that says "skipped" for such rows,
and "matched" for the one that, uh, matches. (Please try calling your
function with "select * from" which should give nicer output.)

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2015-12-03 21:09:43 Re: Error with index on unlogged table
Previous Message Pavel Stehule 2015-12-03 20:45:44 Re: pg_hba_lookup function to get all matching pg_hba.conf entries