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

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Simon Riggs <simon(at)2ndQuadrant(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ALTER TABLESPACE ... MOVE ALL TO ...
Date: 2014-01-20 14:46:51
Message-ID: 20140120144651.GJ31026@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

* Simon Riggs (simon(at)2ndQuadrant(dot)com) wrote:
> Not a good argument since IN CURRENT DATABASE applies to all SQL
> commands, so would clearly be unnecessary.

I suppose it depends on how you're looking at it.

ALTER TABLESPACE ... RENAME, for example, updates a shared catalog and
therefore the change is seen across all databases. That's not exactly
"IN CURRENT DATABASE".

> 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.

So you're still looking for an 'OWNED' noise word to be added? Also, I
did add the ability to specify types of objects (it's often that we'll
have a "INDEXES" tablespace, so this made sense), so how about:

ALTER TABLESPACE name MOVE OWNED TO name opt_nowait
ALTER TABLESPACE name MOVE TABLES OWNED TO name opt_nowait
ALTER TABLESPACE name MOVE INDEXES OWNED TO name opt_nowait
ALTER TABLESPACE name MOVE MATERIALIZED VIEWS OWNED TO name opt_nowait

Removing the 'ALL' entirely?

Should there be an "OWNED BY name_list" option also, since that's how we
use 'OWNED' elsewhere? Should the use of "OWNED" elsewhere (eg:
REASSIGN OWNED BY) also support just 'OWNED' to mean the current role
(I'm not entirely sure how much sense that makes, but figured I'd ask).

Thanks,

Stephen

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-01-20 15:22:09 Re: NOT Null constraint on foreign table not working
Previous Message Mel Gorman 2014-01-20 14:46:06 Re: [Lsf-pc] Linux kernel impact on PostgreSQL performance