summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorNeil Conway2004-01-11 04:58:17 +0000
committerNeil Conway2004-01-11 04:58:17 +0000
commite97b8f2da9ee93f3f957bf5bc92b07f5d9e1e1dd (patch)
tree1b48f8067214786c9e7d163d6ff7f0ddc4d33d95 /src/test
parent4cdf51e64627823088a3f94d21bafbb5fc87f9ea (diff)
Add CREATE TRIGGER, CREATE INDEX, and CREATE SEQUENCE to the list of
expressions supported by CREATE SCHEMA. Also added the beginning of some regression tests for CREATE SCHEMA; plenty more work is needed here.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/regress/expected/namespace.out52
-rw-r--r--src/test/regress/parallel_schedule2
-rw-r--r--src/test/regress/serial_schedule3
-rw-r--r--src/test/regress/sql/namespace.sql31
4 files changed, 86 insertions, 2 deletions
diff --git a/src/test/regress/expected/namespace.out b/src/test/regress/expected/namespace.out
new file mode 100644
index 00000000000..60e3a82ea34
--- /dev/null
+++ b/src/test/regress/expected/namespace.out
@@ -0,0 +1,52 @@
+--
+-- Regression tests for schemas (namespaces)
+--
+CREATE SCHEMA test_schema_1
+ CREATE UNIQUE INDEX abc_a_idx ON abc (a)
+ CREATE VIEW abc_view AS
+ SELECT a+1 AS a, b+1 AS b FROM abc
+ CREATE TABLE abc (
+ a serial,
+ b int UNIQUE
+ );
+NOTICE: CREATE TABLE will create implicit sequence "abc_a_seq" for "serial" column "abc.a"
+NOTICE: CREATE TABLE / UNIQUE will create implicit index "abc_b_key" for table "abc"
+-- verify that the objects were created
+SELECT COUNT(*) FROM pg_class WHERE relnamespace =
+ (SELECT oid FROM pg_namespace WHERE nspname = 'test_schema_1');
+ count
+-------
+ 5
+(1 row)
+
+INSERT INTO test_schema_1.abc DEFAULT VALUES;
+INSERT INTO test_schema_1.abc DEFAULT VALUES;
+INSERT INTO test_schema_1.abc DEFAULT VALUES;
+SELECT * FROM test_schema_1.abc;
+ a | b
+---+---
+ 1 |
+ 2 |
+ 3 |
+(3 rows)
+
+SELECT * FROM test_schema_1.abc_view;
+ a | b
+---+---
+ 2 |
+ 3 |
+ 4 |
+(3 rows)
+
+DROP SCHEMA test_schema_1 CASCADE;
+NOTICE: drop cascades to view test_schema_1.abc_view
+NOTICE: drop cascades to rule _RETURN on view test_schema_1.abc_view
+NOTICE: drop cascades to table test_schema_1.abc
+-- verify that the objects were dropped
+SELECT COUNT(*) FROM pg_class WHERE relnamespace =
+ (SELECT oid FROM pg_namespace WHERE nspname = 'test_schema_1');
+ count
+-------
+ 0
+(1 row)
+
diff --git a/src/test/regress/parallel_schedule b/src/test/regress/parallel_schedule
index a2e34d0f2ab..43a7bcff9ac 100644
--- a/src/test/regress/parallel_schedule
+++ b/src/test/regress/parallel_schedule
@@ -60,7 +60,7 @@ ignore: random
# ----------
# The fourth group of parallel test
# ----------
-test: select_into select_distinct select_distinct_on select_implicit select_having subselect union case join aggregates transactions random portals arrays btree_index hash_index update
+test: select_into select_distinct select_distinct_on select_implicit select_having subselect union case join aggregates transactions random portals arrays btree_index hash_index update namespace
test: privileges
test: misc
diff --git a/src/test/regress/serial_schedule b/src/test/regress/serial_schedule
index 5f3a7bba9a5..61ac9eff335 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.23 2003/11/29 19:52:14 pgsql Exp $
+# $PostgreSQL: pgsql/src/test/regress/serial_schedule,v 1.24 2004/01/11 04:58:17 neilc Exp $
# This should probably be in an order similar to parallel_schedule.
test: boolean
test: char
@@ -73,6 +73,7 @@ test: arrays
test: btree_index
test: hash_index
test: update
+test: namespace
test: privileges
test: misc
test: select_views
diff --git a/src/test/regress/sql/namespace.sql b/src/test/regress/sql/namespace.sql
new file mode 100644
index 00000000000..919f72ada2b
--- /dev/null
+++ b/src/test/regress/sql/namespace.sql
@@ -0,0 +1,31 @@
+--
+-- Regression tests for schemas (namespaces)
+--
+
+CREATE SCHEMA test_schema_1
+ CREATE UNIQUE INDEX abc_a_idx ON abc (a)
+
+ CREATE VIEW abc_view AS
+ SELECT a+1 AS a, b+1 AS b FROM abc
+
+ CREATE TABLE abc (
+ a serial,
+ b int UNIQUE
+ );
+
+-- verify that the objects were created
+SELECT COUNT(*) FROM pg_class WHERE relnamespace =
+ (SELECT oid FROM pg_namespace WHERE nspname = 'test_schema_1');
+
+INSERT INTO test_schema_1.abc DEFAULT VALUES;
+INSERT INTO test_schema_1.abc DEFAULT VALUES;
+INSERT INTO test_schema_1.abc DEFAULT VALUES;
+
+SELECT * FROM test_schema_1.abc;
+SELECT * FROM test_schema_1.abc_view;
+
+DROP SCHEMA test_schema_1 CASCADE;
+
+-- verify that the objects were dropped
+SELECT COUNT(*) FROM pg_class WHERE relnamespace =
+ (SELECT oid FROM pg_namespace WHERE nspname = 'test_schema_1');