summaryrefslogtreecommitdiff
path: root/src/test/regress/input/tablespace.source
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2007-01-02 21:43:36 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2007-01-02 21:43:36 +0000
commit09d09b988df4fba7c800445da73cb09a915f940c (patch)
tree74f9a99a5544bc4ae9db6eaaecabc419d5f99be4 /src/test/regress/input/tablespace.source
parentcac2d912d97321bf43b2d6c50fa67154763ce5c5 (diff)
downloadpostgresql-09d09b988df4fba7c800445da73cb09a915f940c.tar.gz
Add a regression test for ALTER SET TABLESPACE; this is a whole separate
code path in tablecmds.c that wasn't exercised at all before.
Diffstat (limited to 'src/test/regress/input/tablespace.source')
-rw-r--r--src/test/regress/input/tablespace.source11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/regress/input/tablespace.source b/src/test/regress/input/tablespace.source
index 9e2c358094..df5479d589 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';