Grant command help -- postgres

Started by akp geekover 15 years ago3 messagesgeneral
Jump to latest
#1akp geek
akpgeek@gmail.com

Hi All -

I created a schema , I used pg_restore with postgres as user
and restored every thing to the new schema I created. Now I want to change
the owner ship of the schema and all its objects to a different user other
than postgres. Is it possible to do that with one command?

Thanks for the help
Regards

#2Gary Chambers
gwchamb@gmail.com
In reply to: akp geek (#1)
Re: Grant command help -- postgres

akp geek,

I created a schema , I used pg_restore with postgres as user and restored every thing to the new schema I
created. Now I want to change the owner ship of the schema and all its objects to a different user
other than postgres. Is it possible to do that with one command?

In those cases, I will create a user, then create a schema owned by
that user (and oftentimes remove login privileges if it's mostly
static):

create user blah encrypted password 'my_password';
create schema authorization blah;

After that, it's only a matter of executing:

pg_restore -U postgres -n blah -d db yourdumpfile.dmp

This is predicated on having executed pg_dump with the -Fc (custom
format) option. I haven't tested it with an text dump file.

-- Gary Chambers

#3akp geek
akpgeek@gmail.com
In reply to: Gary Chambers (#2)
Re: Grant command help -- postgres

Thanks for the help. it worked

On Wed, Dec 1, 2010 at 11:10 AM, Gary Chambers <gwchamb@gmail.com> wrote:

Show quoted text

akp geek,

I created a schema , I used pg_restore with postgres as user and restored

every thing to the new schema I

created. Now I want to change the owner ship of the schema and all its

objects to a different user

other than postgres. Is it possible to do that with one command?

In those cases, I will create a user, then create a schema owned by
that user (and oftentimes remove login privileges if it's mostly
static):

create user blah encrypted password 'my_password';
create schema authorization blah;

After that, it's only a matter of executing:

pg_restore -U postgres -n blah -d db yourdumpfile.dmp

This is predicated on having executed pg_dump with the -Fc (custom
format) option. I haven't tested it with an text dump file.

-- Gary Chambers

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general