Re: Why pg_hba not in table? - Mailing list pgsql-general

From Tom Lane
Subject Re: Why pg_hba not in table?
Date
Msg-id 29763.1139343841@sss.pgh.pa.us
Whole thread Raw
In response to Re: Why pg_hba not in table?  (Chris Browne <cbbrowne@acm.org>)
Responses Re: Why pg_hba not in table?  (Michael Fuhr <mike@fuhr.org>)
List pgsql-general
Chris Browne <cbbrowne@acm.org> writes:
> jason.leach@gmail.com ("Jason C. Leach") writes:
>> Why not put pg_hba.conf in a pg table?  Seems like it would be much
>> easier to work with.  After all, if we can keep users in the db
>> tables, why not this?

> ... Because it represents information that needs to be accessed
> *before* a connection to the database is established.

Right; however, we've already solved the problem of maintaining a
flat-file representation of a cluster-wide table: both pg_database and
pg_shadow/pg_authid are handled that way.  I see no reason in principle
why pg_hba.conf couldn't be replaced by a flat-file dump of a database
table.

The interesting part of the problem is designing a tabular
representation that works well and doesn't give up any necessary
features.  The existing definition of pg_hba.conf is pretty
non-orthogonal --- in particular its dependence on entry ordering is
nasty if that's to be translated into a table.  It'd be better to come
up with a model that doesn't depend on entry order, if we can do that
without sacrificing too much flexibility.  And there's too much
variability in what the column entries are --- the notion of tossing a
list or a file inclusion reference into a column may work OK as text,
but it would suck to do that in a table.  (But file insertion could
possibly be dispensed with, on the grounds that you could do the
equivalent with pure SQL manipulations.)  We've also speculated about
adding a CONNECT privilege to databases, which could cover some of the
ground now occupied by pg_hba.conf.

If we go this route, I'd like to see pg_ident.conf also replaced by
a table, or maybe folded into the same table.

One other small point is the bootstrapping problem: if you can't get
into the database to modify the config table, you've got trouble.

Bottom line is that we need a well-thought-out design proposal first.
The coding would probably be pretty straightforward once we had a
design that would work.

            regards, tom lane

pgsql-general by date:

Previous
From: Chris Browne
Date:
Subject: Re: Why pg_hba not in table?
Next
From: jao@geophile.com
Date:
Subject: Re: B-tree performance improvements in 8.x