diff options
author | Stephen Frost <sfrost@snowman.net> | 2014-01-18 18:56:40 -0500 |
---|---|---|
committer | Stephen Frost <sfrost@snowman.net> | 2014-01-18 18:56:40 -0500 |
commit | 76e91b38ba64e1da70ea21744b342cb105ea3400 (patch) | |
tree | bc485da708d31d5484d5a3de6489cf73684a9640 /src/backend/nodes/copyfuncs.c | |
parent | 6f25c62d788ea6312fe718ed57a3d169d8efc066 (diff) | |
download | postgresql-76e91b38ba64e1da70ea21744b342cb105ea3400.tar.gz postgresql-76e91b38ba64e1da70ea21744b342cb105ea3400.zip |
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).
Diffstat (limited to 'src/backend/nodes/copyfuncs.c')
-rw-r--r-- | src/backend/nodes/copyfuncs.c | 15 |
1 files changed, 15 insertions, 0 deletions
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; |