Re: ALTER TABLESPACE ... MOVE ALL TO ...

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ALTER TABLESPACE ... MOVE ALL TO ...
Date: 2014-01-20 14:14:02
Message-ID: CA+U5nM+u2rV8kZ9Lk7kMXExupg61u1ds_abpREKj3a81Z5Y=3A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 20 January 2014 14:24, Stephen Frost <sfrost(at)snowman(dot)net> wrote:
> * Simon Riggs (simon(at)2ndQuadrant(dot)com) wrote:
>> The command uses the word ALL but then less than all objects, i.e.
>> only moves objects that are owned by the user.
>
> My thinking was that it was "all" from that user's perspective.
>
>> I would like to see two variants of this...
>>
>> ALL ... which attempts to move all objects and fails if it doesn't own
>> everything
>> ALL OWNED ... which moves only objects that it owns, and ignores others
>
> I could add that, though it feels like the next request would be to
> allow a specific role to be passed in (ie: move all of *this* user's
> objects) and I'm not sure we really need to go to that level. It
> doesn't seem like there's really much point in having two options
> either- "ALL OWNED" run by the superuser would be identical to "ALL" and
> normal users would have zero use for just "ALL" because it would either
> be identical to "ALL OWNED" or it would fail with a permission denied
> error.
>
> If an extra noise word to clarify what is happening would be useful,
> then I could simply require "OWNED" as well, but I'm not particularly
> thrilled with that option, also ...
>
>> i.e. ALL should mean all
>
> This is a bit of a non-starter when it comes to tablespaces anyway- we
> can't move another database's objects and so even if it was "ALL", it
> may only be moving a subset of the objects in the tablespace (namely
> those which are in the current database). I don't see it being an
> improvement to require "IN CURRENT DATABASE ALL OWNED" even though it
> would be more accurate.

Not a good argument since IN CURRENT DATABASE applies to all SQL
commands, so would clearly be unnecessary.

At the moment, ALL does not include all objects. It's a POLA violation
to have a command affect just some objects and not others. That is
especially confusing when the command run as Superuser *will* move all
objects and a RC of zero has different meaning dependent upon who the
user is that executes the command.

--
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Florian Pflug 2014-01-20 14:20:51 Re: [PATCH] Negative Transition Aggregate Functions (WIP)
Previous Message Dean Rasheed 2014-01-20 14:06:12 Re: array_length(anyarray)