@@ -41,6 +41,20 @@ SELECT relname, spcname FROM pg_catalog.pg_tablespace t, pg_catalog.pg_class c
4141 foo_idx | testspace
4242(1 row)
4343
44+ -- let's try moving a table from one place to another
45+ CREATE TABLE testschema.atable AS VALUES (1), (2);
46+ CREATE UNIQUE INDEX anindex ON testschema.atable(column1);
47+ ALTER TABLE testschema.atable SET TABLESPACE testspace;
48+ ALTER INDEX testschema.anindex SET TABLESPACE testspace;
49+ INSERT INTO testschema.atable VALUES(3);-- ok
50+ INSERT INTO testschema.atable VALUES(1);-- fail (checks index)
51+ ERROR: duplicate key violates unique constraint "anindex"
52+ SELECT COUNT(*) FROM testschema.atable;-- checks heap
53+ count
54+ -------
55+ 3
56+ (1 row)
57+
4458-- Will fail with bad path
4559CREATE TABLESPACE badspace LOCATION '/no/such/location';
4660ERROR: could not set permissions on directory "/no/such/location": No such file or directory
@@ -51,6 +65,7 @@ ERROR: tablespace "nosuchspace" does not exist
5165DROP TABLESPACE testspace;
5266ERROR: tablespace "testspace" is not empty
5367DROP SCHEMA testschema CASCADE;
68+ NOTICE: drop cascades to table testschema.atable
5469NOTICE: drop cascades to table testschema.asexecute
5570NOTICE: drop cascades to table testschema.asselect
5671NOTICE: drop cascades to table testschema.foo