Re: [REASSIGN confusion]

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
Cc: Michael Anderson <michael(dot)anderson(at)elegosoft(dot)com>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: [REASSIGN confusion]
Date: 2015-12-16 13:22:00
Message-ID: 20151216132200.GG2618@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Guillaume Lelarge wrote:
> 2015-12-15 14:05 GMT+01:00 Michael Anderson <michael(dot)anderson(at)elegosoft(dot)com>

> > It seems to me that the most common task for an administrator would be to
> > either:
> >
> > change ownership of all objects on a single database owned by old_role
> > without affecting any other databases
> > or
> > change ownership of all objects on all databases owned by old_role.
> >
> > As I understand it, I can't use REASSIGN to perform either of these tasks.
> > Or am I missing something?
>
> Nope, that's it. You need to execute REASSIGN on each database to change
> ownership of all objects on all databases.

The reason we don't have a command to reassign all the objects in all
databases is that it's not possible to implement it inside the server:
each session is connected to one database only, and can only run
commands to modify that database. So you need one session in each
database in order to modify the objects in that database. But "shared"
objects can be modified in any database, so global objects (databases
and tablespaces) are reassigned in the first session.

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Kevin Grittner 2015-12-16 13:41:37 Re: semop hanging - Postgres 9.4.4
Previous Message Albe Laurenz 2015-12-16 12:26:56 Re: semop hanging - Postgres 9.4.4