aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/test/regress/input/tablespace.source11
-rw-r--r--src/test/regress/output/tablespace.source15
2 files changed, 26 insertions, 0 deletions
diff --git a/src/test/regress/input/tablespace.source b/src/test/regress/input/tablespace.source
index 9e2c3580947..df5479d5893 100644
--- a/src/test/regress/input/tablespace.source
+++ b/src/test/regress/input/tablespace.source
@@ -28,6 +28,17 @@ CREATE INDEX foo_idx on testschema.foo(i) TABLESPACE testspace;
SELECT relname, spcname FROM pg_catalog.pg_tablespace t, pg_catalog.pg_class c
where c.reltablespace = t.oid AND c.relname = 'foo_idx';
+-- let's try moving a table from one place to another
+CREATE TABLE testschema.atable AS VALUES (1), (2);
+CREATE UNIQUE INDEX anindex ON testschema.atable(column1);
+
+ALTER TABLE testschema.atable SET TABLESPACE testspace;
+ALTER INDEX testschema.anindex SET TABLESPACE testspace;
+
+INSERT INTO testschema.atable VALUES(3); -- ok
+INSERT INTO testschema.atable VALUES(1); -- fail (checks index)
+SELECT COUNT(*) FROM testschema.atable; -- checks heap
+
-- Will fail with bad path
CREATE TABLESPACE badspace LOCATION '/no/such/location';
diff --git a/src/test/regress/output/tablespace.source b/src/test/regress/output/tablespace.source
index d75493fb0b6..8ab6b68f124 100644
--- a/src/test/regress/output/tablespace.source
+++ b/src/test/regress/output/tablespace.source
@@ -41,6 +41,20 @@ SELECT relname, spcname FROM pg_catalog.pg_tablespace t, pg_catalog.pg_class c
foo_idx | testspace
(1 row)
+-- let's try moving a table from one place to another
+CREATE TABLE testschema.atable AS VALUES (1), (2);
+CREATE UNIQUE INDEX anindex ON testschema.atable(column1);
+ALTER TABLE testschema.atable SET TABLESPACE testspace;
+ALTER INDEX testschema.anindex SET TABLESPACE testspace;
+INSERT INTO testschema.atable VALUES(3); -- ok
+INSERT INTO testschema.atable VALUES(1); -- fail (checks index)
+ERROR: duplicate key violates unique constraint "anindex"
+SELECT COUNT(*) FROM testschema.atable; -- checks heap
+ count
+-------
+ 3
+(1 row)
+
-- Will fail with bad path
CREATE TABLESPACE badspace LOCATION '/no/such/location';
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
DROP TABLESPACE testspace;
ERROR: tablespace "testspace" is not empty
DROP SCHEMA testschema CASCADE;
+NOTICE: drop cascades to table testschema.atable
NOTICE: drop cascades to table testschema.asexecute
NOTICE: drop cascades to table testschema.asselect
NOTICE: drop cascades to table testschema.foo