diff options
| author | Tom Lane | 2004-06-18 06:14:31 +0000 |
|---|---|---|
| committer | Tom Lane | 2004-06-18 06:14:31 +0000 |
| commit | 2467394ee1566e82d0314d12a0d1c0a5670a28c9 (patch) | |
| tree | 57b87b8c181a9c3eb0f33bf775a5f31b9de8b890 /src/test | |
| parent | 474875f4438ea0d18f9f4170117bc407e6812515 (diff) | |
Tablespaces. Alternate database locations are dead, long live tablespaces.
There are various things left to do: contrib dbsize and oid2name modules
need work, and so does the documentation. Also someone should think about
COMMENT ON TABLESPACE and maybe RENAME TABLESPACE. Also initlocation is
dead, it just doesn't know it yet.
Gavin Sherry and Tom Lane.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/GNUmakefile | 12 | ||||
| -rw-r--r-- | src/test/regress/expected/sanity_check.out | 3 | ||||
| -rw-r--r-- | src/test/regress/input/tablespace.source | 36 | ||||
| -rw-r--r-- | src/test/regress/output/tablespace.source | 45 | ||||
| -rw-r--r-- | src/test/regress/parallel_schedule | 5 | ||||
| -rw-r--r-- | src/test/regress/serial_schedule | 3 |
6 files changed, 99 insertions, 5 deletions
diff --git a/src/test/regress/GNUmakefile b/src/test/regress/GNUmakefile index 61a2f9f790a..1fdd1f1e5c1 100644 --- a/src/test/regress/GNUmakefile +++ b/src/test/regress/GNUmakefile @@ -7,7 +7,7 @@ # # # IDENTIFICATION -# $PostgreSQL: pgsql/src/test/regress/GNUmakefile,v 1.46 2004/03/03 04:22:47 momjian Exp $ +# $PostgreSQL: pgsql/src/test/regress/GNUmakefile,v 1.47 2004/06/18 06:14:25 tgl Exp $ # #------------------------------------------------------------------------- @@ -67,7 +67,7 @@ all: $(DLOBJS) # Build test input and expected files -file_list := copy create_function_1 create_function_2 misc constraints +file_list := copy create_function_1 create_function_2 misc constraints tablespace input_files := $(foreach file, $(file_list), sql/$(file).sql) output_files := $(foreach file, $(file_list), expected/$(file).out) @@ -81,10 +81,13 @@ abs_srcdir := $(shell cd $(srcdir) && pwd -W) abs_builddir := $(shell pwd -W) endif +testtablespace := $(abs_builddir)/testtablespace + define sed-command sed -e 's,@abs_srcdir@,$(abs_srcdir),g' \ -e 's,@abs_builddir@,$(abs_builddir),g' \ + -e 's,@testtablespace@,$(testtablespace),g' \ -e 's/@DLSUFFIX@/$(DLSUFFIX)/g' $< >$@ endef @@ -125,9 +128,13 @@ all-spi: ## check: all + -rm -rf ./testtablespace + mkdir ./testtablespace $(SHELL) ./pg_regress --temp-install --top-builddir=$(top_builddir) --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) $(MAXCONNOPT) installcheck: all + -rm -rf ./testtablespace + mkdir ./testtablespace $(SHELL) ./pg_regress --schedule=$(srcdir)/serial_schedule --multibyte=$(MULTIBYTE) @@ -152,6 +159,7 @@ clean distclean maintainer-clean: $(MAKE) -C $(contribdir)/spi clean rm -f $(output_files) $(input_files) $(DLOBJS) regress.o pg_regress # things created by various check targets + rm -rf testtablespace rm -rf results tmp_check log rm -f regression.diffs regression.out regress.out run_check.out ifeq ($(PORTNAME), cygwin) diff --git a/src/test/regress/expected/sanity_check.out b/src/test/regress/expected/sanity_check.out index 87e1943e5a2..00abd941ccf 100644 --- a/src/test/regress/expected/sanity_check.out +++ b/src/test/regress/expected/sanity_check.out @@ -56,13 +56,14 @@ SELECT relname, relhasindex pg_rewrite | t pg_shadow | t pg_statistic | t + pg_tablespace | t pg_trigger | t pg_type | t road | t shighway | t tenk1 | t tenk2 | t -(52 rows) +(53 rows) -- -- another sanity check: every system catalog that has OIDs should have diff --git a/src/test/regress/input/tablespace.source b/src/test/regress/input/tablespace.source new file mode 100644 index 00000000000..460d4433a84 --- /dev/null +++ b/src/test/regress/input/tablespace.source @@ -0,0 +1,36 @@ +-- create a tablespace we can use +CREATE TABLESPACE testspace LOCATION '@testtablespace@'; + +-- create a schema in the tablespace +CREATE SCHEMA testschema TABLESPACE testspace; + +-- sanity check +SELECT nspname, spcname FROM pg_catalog.pg_tablespace t, pg_catalog.pg_namespace n + where n.nsptablespace = t.oid and n.nspname = 'testschema'; + +-- try a table +CREATE TABLE testschema.foo (i int); +SELECT relname, spcname FROM pg_catalog.pg_tablespace t, pg_catalog.pg_class c + where c.reltablespace = t.oid AND c.relname = 'foo'; + +INSERT INTO testschema.foo VALUES(1); +INSERT INTO testschema.foo VALUES(2); + +-- index +CREATE INDEX foo_idx on testschema.foo(i); +SELECT relname, spcname FROM pg_catalog.pg_tablespace t, pg_catalog.pg_class c + where c.reltablespace = t.oid AND c.relname = 'foo_idx'; + +-- Will fail with bad path +CREATE TABLESPACE badspace LOCATION '/no/such/location'; + +-- No such tablespace +CREATE TABLE bar (i int) TABLESPACE nosuchspace; + +-- Fail, not empty +DROP TABLESPACE testspace; + +DROP SCHEMA testschema CASCADE; + +-- Should succeed +DROP TABLESPACE testspace; diff --git a/src/test/regress/output/tablespace.source b/src/test/regress/output/tablespace.source new file mode 100644 index 00000000000..43044a2bcf8 --- /dev/null +++ b/src/test/regress/output/tablespace.source @@ -0,0 +1,45 @@ +-- create a tablespace we can use +CREATE TABLESPACE testspace LOCATION '@testtablespace@'; +-- create a schema in the tablespace +CREATE SCHEMA testschema TABLESPACE testspace; +-- sanity check +SELECT nspname, spcname FROM pg_catalog.pg_tablespace t, pg_catalog.pg_namespace n + where n.nsptablespace = t.oid and n.nspname = 'testschema'; + nspname | spcname +------------+----------- + testschema | testspace +(1 row) + +-- try a table +CREATE TABLE testschema.foo (i int); +SELECT relname, spcname FROM pg_catalog.pg_tablespace t, pg_catalog.pg_class c + where c.reltablespace = t.oid AND c.relname = 'foo'; + relname | spcname +---------+----------- + foo | testspace +(1 row) + +INSERT INTO testschema.foo VALUES(1); +INSERT INTO testschema.foo VALUES(2); +-- index +CREATE INDEX foo_idx on testschema.foo(i); +SELECT relname, spcname FROM pg_catalog.pg_tablespace t, pg_catalog.pg_class c + where c.reltablespace = t.oid AND c.relname = 'foo_idx'; + relname | spcname +---------+----------- + foo_idx | testspace +(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 +-- No such tablespace +CREATE TABLE bar (i int) TABLESPACE nosuchspace; +ERROR: tablespace "nosuchspace" does not exist +-- Fail, not empty +DROP TABLESPACE testspace; +ERROR: tablespace "testspace" is not empty +DROP SCHEMA testschema CASCADE; +NOTICE: drop cascades to table testschema.foo +-- Should succeed +DROP TABLESPACE testspace; diff --git a/src/test/regress/parallel_schedule b/src/test/regress/parallel_schedule index 035a81543f3..b3a4de3b56f 100644 --- a/src/test/regress/parallel_schedule +++ b/src/test/regress/parallel_schedule @@ -16,7 +16,7 @@ test: point lseg box path polygon circle date time timetz timestamp timestamptz # Depends on point, lseg, box, path, polygon and circle test: geometry # Depends on interval, timetz, timestamp, timestamptz, reltime and abstime -test: horology +test: horology # ---------- # These four each depend on the previous one @@ -78,3 +78,6 @@ test: limit plpgsql copy2 temp domain rangefuncs prepare without_oid conversion # run stats by itself because its delay may be insufficient under heavy load test: stats + +# run tablespace by itself +test: tablespace diff --git a/src/test/regress/serial_schedule b/src/test/regress/serial_schedule index 1dd7a03cc7a..f8621b404ac 100644 --- a/src/test/regress/serial_schedule +++ b/src/test/regress/serial_schedule @@ -1,4 +1,4 @@ -# $PostgreSQL: pgsql/src/test/regress/serial_schedule,v 1.25 2004/06/06 21:20:46 tgl Exp $ +# $PostgreSQL: pgsql/src/test/regress/serial_schedule,v 1.26 2004/06/18 06:14:25 tgl Exp $ # This should probably be in an order similar to parallel_schedule. test: boolean test: char @@ -96,3 +96,4 @@ test: sequence test: polymorphism test: rowtypes test: stats +test: tablespace |
