diff options
author | Stephen Frost <sfrost@snowman.net> | 2014-01-23 23:52:40 -0500 |
---|---|---|
committer | Stephen Frost <sfrost@snowman.net> | 2014-01-23 23:52:40 -0500 |
commit | fbe19ee3b87590f1006d072be5fecf8a33d4e9f5 (patch) | |
tree | 1e4a87ee5af49862e84d372d1ad29f278ca5648a /doc/src | |
parent | 3ee74df2e48cde3c471637d14b18475abb0eb69a (diff) | |
download | postgresql-fbe19ee3b87590f1006d072be5fecf8a33d4e9f5.tar.gz postgresql-fbe19ee3b87590f1006d072be5fecf8a33d4e9f5.zip |
ALTER TABLESPACE ... MOVE ... OWNED BY
Add the ability to specify the objects to move by who those objects are
owned by (as relowner) and change ALL to mean ALL objects. This
makes the command always operate against a well-defined set of objects
and not have the objects-to-be-moved based on the role of the user
running the command.
Per discussion with Simon and Tom.
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/ref/alter_tablespace.sgml | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/doc/src/sgml/ref/alter_tablespace.sgml b/doc/src/sgml/ref/alter_tablespace.sgml index 0dfa4652fd7..99ee08a8da5 100644 --- a/doc/src/sgml/ref/alter_tablespace.sgml +++ b/doc/src/sgml/ref/alter_tablespace.sgml @@ -25,7 +25,7 @@ ALTER TABLESPACE <replaceable>name</replaceable> RENAME TO <replaceable>new_name ALTER TABLESPACE <replaceable>name</replaceable> OWNER TO <replaceable>new_owner</replaceable> ALTER TABLESPACE <replaceable>name</replaceable> SET ( <replaceable class="PARAMETER">tablespace_option</replaceable> = <replaceable class="PARAMETER">value</replaceable> [, ... ] ) ALTER TABLESPACE <replaceable>name</replaceable> RESET ( <replaceable class="PARAMETER">tablespace_option</replaceable> [, ... ] ) -ALTER TABLESPACE <replaceable>name</replaceable> MOVE { ALL | TABLES | INDEXES | MATERIALIZED VIEWS } TO <replaceable>new_tablespace</replaceable> [ NOWAIT ] +ALTER TABLESPACE <replaceable>name</replaceable> MOVE { ALL | TABLES | INDEXES | MATERIALIZED VIEWS } [ OWNED BY <replaceable class="PARAMETER">role_name</replaceable> [, ...] ] TO <replaceable>new_tablespace</replaceable> [ NOWAIT ] </synopsis> </refsynopsisdiv> @@ -34,8 +34,8 @@ ALTER TABLESPACE <replaceable>name</replaceable> MOVE { ALL | TABLES | INDEXES | <para> <command>ALTER TABLESPACE</command> can be used to change the definition of - a tablespace or to migrate all of the objects in the current database which - are owned by the user out of a given tablespace. + a tablespace or to migrate objects in the current database between + tablespaces. </para> <para> @@ -44,13 +44,19 @@ ALTER TABLESPACE <replaceable>name</replaceable> MOVE { ALL | TABLES | INDEXES | owning role. (Note that superusers have these privileges automatically.) - Users may use ALTER TABLESPACE ... MOVE to move either ALL of their objects, - or just TABLES, INDEXES, or MATERIALIZED VIEWS, but they must have CREATE - rights on the new tablespace and only objects, directly or indirectly, owned - by the user will be moved. Note that the superuser is considered an owner - of all objects and therefore an ALTER TABLESPACE ... MOVE ALL issued by the - superuser will move all objects in the current database which are in the - tablespace. + Users may use ALTER TABLESPACE ... MOVE to move objects between tablespaces. + ALL will move all tables, indexes and materialized views while specifying + TABLES will move only tables (but not their indexes), INDEXES will only move + indexes (including those underneath materialized views, but not tables) and + MATERIALIZED VIEWS will only move the table relation of the materialized + view (but no indexes associated with it). Users may also specify a list of + roles whose objects are to be moved using OWNED BY. + + Users must have CREATE rights on the new tablespace and be considered an + owner (either directly or indirectly) on all objects to be moved. Note that + the superuser is considered an owner of all objects and therefore an + ALTER TABLESPACE ... MOVE ALL issued by the superuser will move all objects + in the current database which are in the tablespace. All objects to be moved will be locked immediately by the command. The NOWAIT option, if specified, will cause the command to fail if it is unable @@ -116,6 +122,15 @@ ALTER TABLESPACE <replaceable>name</replaceable> MOVE { ALL | TABLES | INDEXES | </varlistentry> <varlistentry> + <term><replaceable class="parameter">role_name</replaceable></term> + <listitem> + <para> + Role(s) whose objects are to be moved. + </para> + </listitem> + </varlistentry> + + <varlistentry> <term><replaceable class="parameter">new_tablespace</replaceable></term> <listitem> <para> |