mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Rework 'MOVE ALL' to 'ALTER .. ALL IN TABLESPACE'
As 'ALTER TABLESPACE .. MOVE ALL' really didn't change the tablespace but instead changed objects inside tablespaces, it made sense to rework the syntax and supporting functions to operate under the 'ALTER (TABLE|INDEX|MATERIALIZED VIEW)' syntax and to be in tablecmds.c. Pointed out by Alvaro, who also suggested the new syntax. Back-patch to 9.4.
This commit is contained in:
@ -76,10 +76,11 @@ CREATE TABLE tablespace_table (i int) TABLESPACE testspace; -- fail
|
||||
|
||||
ALTER TABLESPACE testspace RENAME TO testspace_renamed;
|
||||
|
||||
ALTER TABLESPACE testspace_renamed MOVE ALL TO pg_default;
|
||||
ALTER TABLE ALL IN TABLESPACE testspace_renamed SET TABLESPACE pg_default;
|
||||
ALTER INDEX ALL IN TABLESPACE testspace_renamed SET TABLESPACE pg_default;
|
||||
|
||||
-- Should show notice that nothing was done
|
||||
ALTER TABLESPACE testspace_renamed MOVE ALL TO pg_default;
|
||||
ALTER TABLE ALL IN TABLESPACE testspace_renamed SET TABLESPACE pg_default;
|
||||
|
||||
-- Should succeed
|
||||
DROP TABLESPACE testspace_renamed;
|
||||
|
@ -93,9 +93,10 @@ CREATE TABLE tablespace_table (i int) TABLESPACE testspace; -- fail
|
||||
ERROR: permission denied for tablespace testspace
|
||||
\c -
|
||||
ALTER TABLESPACE testspace RENAME TO testspace_renamed;
|
||||
ALTER TABLESPACE testspace_renamed MOVE ALL TO pg_default;
|
||||
ALTER TABLE ALL IN TABLESPACE testspace_renamed SET TABLESPACE pg_default;
|
||||
ALTER INDEX ALL IN TABLESPACE testspace_renamed SET TABLESPACE pg_default;
|
||||
-- Should show notice that nothing was done
|
||||
ALTER TABLESPACE testspace_renamed MOVE ALL TO pg_default;
|
||||
ALTER TABLE ALL IN TABLESPACE testspace_renamed SET TABLESPACE pg_default;
|
||||
NOTICE: no matching relations in tablespace "testspace_renamed" found
|
||||
-- Should succeed
|
||||
DROP TABLESPACE testspace_renamed;
|
||||
|
Reference in New Issue
Block a user