Re: Per database users/admins, handy for database virtual hosting...

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Sean Chittenden <sean(at)chittenden(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Per database users/admins, handy for database virtual hosting...
Date: 2004-03-26 02:45:28
Message-ID: 17971.1080269128@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Sean Chittenden <sean(at)chittenden(dot)org> writes:
> What's the feasibility of augmenting the system catalogs so that
> something similar to the following is possible:

> CREATE VIEW pg_catalog.pg_shadow AS
> SELECT usename, usesysid, usecreatedb, usesuper,
> usecatupd, passwd, valuntil, useconfig
> FROM pg_catalog.pg_shadow_cluster
> UNION ALL
> SELECT usename, usesysid, usecreatedb, usesuper,
> usecatupd, passwd, valuntil, useconfig
> FROM pg_catalog.pg_shadow_db;

The main problem I can see is usesysid conflicts. For example suppose
userid 42 is created in database A, and then someone in database B
decides to create a global user with id 42. The latter someone can't
even see that he's causing a problem in database A :-(

I'd be in favor of this if we could find an answer to that one.

Maybe something dirty like reserving separate ranges of sysid for local
and global users would get the job done, but I haven't spent any time
trying to poke holes in that idea...

Come to think of it, the same risk of conflict applies for user *names*,
and we can't easily make an end-run around that.

> And then set up RULEs to direct INSERTs, UPDATEs, DELETEs from
> pg_shadow to pg_shadow_db. CREATE USER/ALTER USER operates on
> pg_catalog_db, then CREATE CLUSTER USER/ALTER CLUSTER USER operates on
> pg_catalog_cluster.

Nope, other way round, default behavior for backwards compatibility must
be to create cluster-wide users. CREATE LOCAL USER is what to add.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2004-03-26 03:32:12 Transaction block states
Previous Message Christopher Kings-Lynne 2004-03-26 02:07:45 Re: Nested transaction proposal - take N (N > 2)