From: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com> |
---|---|
To: | Simon Riggs <simon(at)2ndquadrant(dot)com> |
Cc: | Stephen Frost <sfrost(at)snowman(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: ALTER TABLESPACE ... MOVE ALL TO ... |
Date: | 2014-01-31 16:48:23 |
Message-ID: | CAHGQGwFvs91d+u8-ijerwUEM141UX1o28EpK92sR2FQBSu6n_A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Jan 30, 2014 at 8:47 PM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
> On Tue, Jan 21, 2014 at 1:33 AM, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:
>> On 20 January 2014 17:00, Stephen Frost <sfrost(at)snowman(dot)net> wrote:
>>> * Tom Lane (tgl(at)sss(dot)pgh(dot)pa(dot)us) wrote:
>>>> What if you're a superuser and you want to move everybody's objects
>>>> (perhaps in preparation for dropping the tablespace)? I think there's
>>>> value in both the ALL and OWNED forms.
>>>
>>> A superuser is considered to 'own' all objects and so 'ALL' and 'OWNED'
>>> above would be the same when issued by a superuser, in the current
>>> implementation.
>>>
>>> Looking at DROP OWNED and REASSIGN OWNED, they operate at the more
>>> specific level of "OWNED" == "relowner" rather than if the role is
>>> considered an 'owner' of the object through role membership, as you are
>>> implying above.
>>>
>>> As such, I'll rework this to be more in-line with the existing OWNED BY
>>> semantics of REASSIGN OWNED BY and DROP OWNED BY, which means we'd have:
>>>
>>> ALTER TABLESPACE name MOVE [ ALL | OWNED [ BY reluser ] ]
>>> [ TABLES | INDEXES | MATERIALIZED VIEWS ] TO name opt_nowait
>>>
>>> eg:
>>>
>>> ALTER TABLESPACE tblspc1 MOVE ALL TO tblspc2;
>>> ALTER TABLESPACE tblspc1 MOVE OWNED TO tblspc2;
>>> ALTER TABLESPACE tblspc1 MOVE OWNED BY myrole TO tblspc2;
>>> ALTER TABLESPACE tblspc1 MOVE TABLES OWNED BY myrole TO tblspc2;
>>> ALTER TABLESPACE tblspc1 MOVE ALL OWNED BY myrole TO tblspc2;
>>
>> Sounds great, thanks.
>
> We should add the tab-completion for ALTER TABLESPACE MOVE?
> Attached does that.
Committed.
Regards,
--
Fujii Masao
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2014-01-31 16:57:28 | Re: updated emacs configuration |
Previous Message | Bruce Momjian | 2014-01-31 16:31:40 | Re: small typo in src/backend/access/transam/xlog.c |