From: | "Mario Weilguni" <mweilguni(at)sime(dot)com> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | hide databases/users from normal postgres user |
Date: | 2003-03-05 11:20:54 |
Message-ID: | 000701c2e309$49b5feb0$8f01c00a@icomedias.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Is it possible to hide the list of databases. The query is
SELECT d.datname as "Name",
u.usename as "Owner"
FROM pg_database d LEFT JOIN pg_user u ON d.datdba = u.usesysid
ORDER BY 1;
so I tried to play with rules like this one:
create rule hide_db as on select to pg_database
do instead
SELECT datname, datdba, encoding, datistemplate, datallowconn,
datlastsysoid, datvacuumxid, datfrozenxid, datpath, datconfig, datacl
FROM pg_catalog.pg_database d
where (
exists (select 1 from pg_user where current_user = usename and
usesuper = true)
or
d.datname=current_user
)
ORDER BY 1;
This would allow a user to see only "his" databases, but that seems to be
impossible to achieve with a rule. Same rules would be for pg_user. A
"revoke select on pg_database" seems to work too, but imo this is not the
best approach. And I'm not sure if a "revoke select on pg_user" will break
the database system.
Regards,
Mario Weilguni
From | Date | Subject | |
---|---|---|---|
Next Message | Mészáros Attila | 2003-03-05 11:57:10 | Powerbuilder + New ODBC + Very important |
Previous Message | er | 2003-03-05 10:49:05 | Re: problem : initdb failed |