"Marc G. Fournier" <scrappy@hub.org> writes:
> Is there any way of the 'master process' *safely/accurately* knowing,
> through the shared memory link, the # of connections currently open to a
> particular database? So that a limit could be set on a per db basis, say
> as an additional arg to pg_hba.conf?
It would be better/easier to apply the check later on, when a backend is
adding itself to the PGPROC array. It'd be easy enough to count the
number of other backends showing the same DB OID in their PGPROC
entries, and reject if too many.
regards, tom lane