Re: Limit on number of users in postgresql?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "John D(dot) Burger" <john(at)mitre(dot)org>
Cc: "pgsql-general postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Limit on number of users in postgresql?
Date: 2007-01-30 01:53:13
Message-ID: 22700.1170121993@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"John D. Burger" <john(at)mitre(dot)org> writes:
> Someone talked about the postmaster having to be "at arms' length"
> from the actual tables. But I was looking at the postmaster code,
> and it seems to fork a new backend as soon as select indicates
> there's a new request, without checking authorization or anything
> first. So why can't the new backend query the user table as normal?
> Even if shared buffers are trashed, that'll only take down the new
> backend, not the original postmaster, right?

Well, the current design is that the postmaster has a copy of the flat
file in memory, which is inherited by backends across the fork(), and
so they can query it at small cost. For the normal situation where
the list of users isn't changing very rapidly, this is probably faster
than your suggestion would be. The issue to make it work like you
suggest is that there's not presently any way to query tables until
*after* you have selected and connected to a particular database.
So you'd still need a flat file representing pg_database, plus it's
unclear how you'd implement some of pg_hba.conf's options like
"samegroup".

Since the tables you need to touch are all shared, it's conceivable that
this could be hacked around, but it seems awfully messy. Another
consideration is that this'd significantly increase the amount of work
done before validating that the connection request is authorized, thus
perhaps making it easier to mount a DOS attack on the postmaster (though
admittedly a blackhat with access to the postmaster port can probably
cause trouble anyway just from the "fork bomb" effect).

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ron Peterson 2007-01-30 01:57:34 programming 'like' operator
Previous Message John D. Burger 2007-01-30 01:52:21 Re: counting query