@@ -41,6 +41,20 @@ SELECT relname, spcname FROM pg_catalog.pg_tablespace t, pg_catalog.pg_class c
41
41
foo_idx | testspace
42
42
(1 row)
43
43
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
+
44
58
-- Will fail with bad path
45
59
CREATE TABLESPACE badspace LOCATION '/no/such/location';
46
60
ERROR: could not set permissions on directory "/no/such/location": No such file or directory
@@ -51,6 +65,7 @@ ERROR: tablespace "nosuchspace" does not exist
51
65
DROP TABLESPACE testspace;
52
66
ERROR: tablespace "testspace" is not empty
53
67
DROP SCHEMA testschema CASCADE;
68
+ NOTICE: drop cascades to table testschema.atable
54
69
NOTICE: drop cascades to table testschema.asexecute
55
70
NOTICE: drop cascades to table testschema.asselect
56
71
NOTICE: drop cascades to table testschema.foo