Обсуждение: Giving a user a database

Поиск
Список
Период
Сортировка

Giving a user a database

От
"Robert C. Mosher II"
Дата:
I need to give a user a single database that they will have full control
over. I am assuming this means giving them ownership of the database,
but I have no idea how to do that, even after looking through the manual
and the mailing list archive. How do I give a user ownership of a
database? Or if there's a better way of granting them full access
(creating and editing tables, etc.) what is it, and how do I do it?

Thanks,
Rob Mosher.


Re: Giving a user a database

От
Josh Berkus
Дата:
Robert,

> I need to give a user a single database that they will have full control
> over. I am assuming this means giving them ownership of the database,
> but I have no idea how to do that, even after looking through the manual
> and the mailing list archive. How do I give a user ownership of a
> database? Or if there's a better way of granting them full access
> (creating and editing tables, etc.) what is it, and how do I do it?

CREATE USER joe WITH PASSWORD 'jehosaphat' CREATEDB;
\c - joe
CREATE DATABASE joes_db;
\c - postgres
ALTER USER joe WITH NOCREATEDB;

then edit pg_hba.conf to have a line where joe can only connect to joes_db.

--
-Josh Berkus
 Aglio Database Solutions
 San Francisco