Re: [WIP] ALTER ... OWNER TO ... CASCADE

From: Vladimir Borodin <root(at)simply(dot)name>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Teodor Sigaev <teodor(at)sigaev(dot)ru>, Dmitry Ivanov <d(dot)ivanov(at)postgrespro(dot)ru>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [WIP] ALTER ... OWNER TO ... CASCADE
Date: 2016-02-16 16:47:51
Message-ID: 83603DF9-6127-4D4E-855D-5448ED129079@simply.name
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


> 16 февр. 2016 г., в 18:20, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> написал(а):
>
> Vladimir Borodin wrote:
>
>>> Moreover, the use case you've sketched (ie, change ownership of all
>>> objects inside a database) doesn't actually have anything to do with
>>> following dependencies. It's a lot closer to REASSIGN OWNED ... in
>>> fact, it's not clear to me why REASSIGN OWNED doesn't solve that
>>> use-case already.
>>
>> Sometimes I hit the following. You have created a database and schema
>> inside it from the superuser (i.e. postgres). Than you want to change
>> ownership of whole database to another user (i.e. alice), but only
>> this database, not all other objects in all other databases. It seems
>> that REASSIGN OWNED doesn’t solve this already.
>
> So essentially you want to change all the objects in the database except
> those that were created together with the database itself (i.e. those
> that were copied from the template database).

Yes. Without such syntax it is now done in a really awful way now, i.e. [0].

[0] https://github.com/saltstack/salt/blob/405d0aef1cf11bb56b5d2320b176f6992e6cdf3b/salt/modules/postgres.py#L1806-L1847

> That seems a reasonable
> use-case, but I'm not sure that this ALTER .. OWNER CASCADE is the right
> thing for that -- What object would you start with? Each schema other
> than pg_catalog, pg_toast, information_schema? As I recall, the problem
> is that REASSIGN OWNED refuses to work on pinned objects. Maybe what
> you want is something like
> REASSIGN OWNED BY xyz IN SCHEMA public TO xyzxxz
> i.e., an extension of the current REASSIGN OWNED BY command?

Well, I don’t know what syntax and implementation would be correct. I just want to give a specific user all rights to manage all objects in a specific database (which was created from postgres user earlier). It would be really useful.

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

--
Да пребудет с вами сила…
https://simply.name/ru

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Victor Wagner 2016-02-16 16:48:57 Re: Small PATCH: check of 2 Perl modules
Previous Message Catalin Iacob 2016-02-16 16:18:15 Re: proposal: PL/Pythonu - function ereport