Re: Grant command help -- postgres

From: Gary Chambers <gwchamb(at)gmail(dot)com>
To:
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Grant command help -- postgres
Date: 2010-12-01 16:10:39
Message-ID: AANLkTimf69qd8EieSU4M02tOxksSjT1yHPnO5uVbkktU@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jolles, Peter M (GE Energy) 2010-12-01 16:41:31 Cannot start Postgres- FATAL: invalid cache id: 19
Previous Message Samba 2010-12-01 15:51:06 [REPOST] plpgsql : looping over multidimensional array : getting NULL for subdimension