Set the permissions while creating database, schema, and tables

Started by dipti shahabout 16 years ago4 messagesgeneral
Jump to latest
#1dipti shah
shahdipti1980@gmail.com

Hi,

Could anyone please help me out here. I want to set the required permissions
while creating PostGreSQL database, schema, and tables from stored
procedures. Is it possible to do it while creating them?

I could see that "OWNER" option is there while creating database but
couldn't see such option for schema or table. Please let me know if I missed
out something.

CREATE DATABASE sales OWNER salesapp TABLESPACE salesspace;

With above command, can I grant permission to particular group of users?

Thanks,
Dipti

#2John R Pierce
pierce@hogranch.com
In reply to: dipti shah (#1)
Re: Set the permissions while creating database, schema, and tables

dipti shah wrote:

Hi,

Could anyone please help me out here. I want to set the required
permissions while creating PostGreSQL database, schema, and tables
from stored procedures. Is it possible to do it while creating them?

I could see that "OWNER" option is there while creating database but
couldn't see such option for schema or table. Please let me know if I
missed out something.

CREATE DATABASE sales OWNER salesapp TABLESPACE salesspace;

With above command, can I grant permission to particular group of users?

you would use the GRANT command to grant permissions

#3dipti shah
shahdipti1980@gmail.com
In reply to: John R Pierce (#2)
Re: Set the permissions while creating database, schema, and tables

That's I know but I was wondering if there is anyway to do it while creating
itself.

On Mon, Feb 15, 2010 at 1:46 PM, John R Pierce <pierce@hogranch.com> wrote:

Show quoted text

dipti shah wrote:

Hi,

Could anyone please help me out here. I want to set the required
permissions while creating PostGreSQL database, schema, and tables from
stored procedures. Is it possible to do it while creating them?

I could see that "OWNER" option is there while creating database but
couldn't see such option for schema or table. Please let me know if I missed
out something.

CREATE DATABASE sales OWNER salesapp TABLESPACE salesspace;

With above command, can I grant permission to particular group of users?

you would use the GRANT command to grant permissions

#4Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: dipti shah (#3)
Re: Set the permissions while creating database, schema, and tables

dipti shah escribi�:

That's I know but I was wondering if there is anyway to do it while creating
itself.

No. You can wrap the CREATE and the GRANT/REVOKE into a transaction so
that the object doesn't appear to users until permissions have been
fixed.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support