From f41872d0c1239d36ab03393c39ec0b70e9ee2a3c Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Fri, 22 Aug 2014 14:27:00 -0400 Subject: Implement ALTER TABLE .. SET LOGGED / UNLOGGED MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This enables changing permanent (logged) tables to unlogged and vice-versa. (Docs for ALTER TABLE / SET TABLESPACE got shuffled in an order that hopefully makes more sense than the original.) Author: Fabrízio de Royes Mello Reviewed by: Christoph Berg, Andres Freund, Thom Brown Some tweaking by Álvaro Herrera --- doc/src/sgml/ref/alter_table.sgml | 64 +++++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 26 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml index 0e7b99c934c..5bbf4fb3595 100644 --- a/doc/src/sgml/ref/alter_table.sgml +++ b/doc/src/sgml/ref/alter_table.sgml @@ -63,6 +63,8 @@ ALTER TABLE ALL IN TABLESPACE name SET WITHOUT CLUSTER SET WITH OIDS SET WITHOUT OIDS + SET TABLESPACE new_tablespace + SET {LOGGED | UNLOGGED} SET ( storage_parameter = value [, ... ] ) RESET ( storage_parameter [, ... ] ) INHERIT parent_table @@ -70,7 +72,6 @@ ALTER TABLE ALL IN TABLESPACE name OF type_name NOT OF OWNER TO new_owner - SET TABLESPACE new_tablespace REPLICA IDENTITY {DEFAULT | USING INDEX index_name | FULL | NOTHING} and table_constraint_using_index is: @@ -478,6 +479,42 @@ ALTER TABLE ALL IN TABLESPACE name + + SET TABLESPACE + + + This form changes the table's tablespace to the specified tablespace and + moves the data file(s) associated with the table to the new tablespace. + Indexes on the table, if any, are not moved; but they can be moved + separately with additional SET TABLESPACE commands. + All tables in the current database in a tablespace can be moved by using + the ALL IN TABLESPACE form, which will lock all tables + to be moved first and then move each one. This form also supports + OWNED BY, which will only move tables owned by the + roles specified. If the NOWAIT option is specified + then the command will fail if it is unable to acquire all of the locks + required immediately. Note that system catalogs are not moved by this + command, use ALTER DATABASE or explicit + ALTER TABLE invocations instead if desired. The + information_schema relations are not considered part + of the system catalogs and will be moved. + See also + . + + + + + + SET {LOGGED | UNLOGGED} + + + This form changes the table from unlogged to logged or vice-versa + (see ). It cannot be applied + to a temporary table. + + + + SET ( storage_parameter = value [, ... ] ) @@ -591,31 +628,6 @@ ALTER TABLE ALL IN TABLESPACE name - - SET TABLESPACE - - - This form changes the table's tablespace to the specified tablespace and - moves the data file(s) associated with the table to the new tablespace. - Indexes on the table, if any, are not moved; but they can be moved - separately with additional SET TABLESPACE commands. - All tables in the current database in a tablespace can be moved by using - the ALL IN TABLESPACE form, which will lock all tables - to be moved first and then move each one. This form also supports - OWNED BY, which will only move tables owned by the - roles specified. If the NOWAIT option is specified - then the command will fail if it is unable to acquire all of the locks - required immediately. Note that system catalogs are not moved by this - command, use ALTER DATABASE or explicit - ALTER TABLE invocations instead if desired. The - information_schema relations are not considered part - of the system catalogs and will be moved. - See also - . - - - - REPLICA IDENTITY -- cgit v1.2.3