From 76e91b38ba64e1da70ea21744b342cb105ea3400 Mon Sep 17 00:00:00 2001 From: Stephen Frost Date: Sat, 18 Jan 2014 18:56:40 -0500 Subject: Add ALTER TABLESPACE ... MOVE command This adds a 'MOVE' sub-command to ALTER TABLESPACE which allows moving sets of objects from one tablespace to another. This can be extremely handy and avoids a lot of error-prone scripting. ALTER TABLESPACE ... MOVE will only move objects the user owns, will notify the user if no objects were found, and can be used to move ALL objects or specific types of objects (TABLES, INDEXES, or MATERIALIZED VIEWS). --- src/backend/nodes/copyfuncs.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/backend/nodes/copyfuncs.c') diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index fb4ce2cf21f..19e5f0495a8 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c @@ -3397,6 +3397,18 @@ _copyAlterTableSpaceOptionsStmt(const AlterTableSpaceOptionsStmt *from) return newnode; } +static AlterTableSpaceMoveStmt * +_copyAlterTableSpaceMoveStmt(const AlterTableSpaceMoveStmt *from) +{ + AlterTableSpaceMoveStmt *newnode = makeNode(AlterTableSpaceMoveStmt); + + COPY_STRING_FIELD(orig_tablespacename); + COPY_STRING_FIELD(new_tablespacename); + COPY_SCALAR_FIELD(nowait); + + return newnode; +} + static CreateExtensionStmt * _copyCreateExtensionStmt(const CreateExtensionStmt *from) { @@ -4408,6 +4420,9 @@ copyObject(const void *from) case T_AlterTableSpaceOptionsStmt: retval = _copyAlterTableSpaceOptionsStmt(from); break; + case T_AlterTableSpaceMoveStmt: + retval = _copyAlterTableSpaceMoveStmt(from); + break; case T_CreateExtensionStmt: retval = _copyCreateExtensionStmt(from); break; -- cgit v1.2.3