summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/regress/expected/drop_if_exists.out67
-rw-r--r--src/test/regress/parallel_schedule2
-rw-r--r--src/test/regress/serial_schedule3
-rw-r--r--src/test/regress/sql/drop_if_exists.sql91
4 files changed, 161 insertions, 2 deletions
diff --git a/src/test/regress/expected/drop_if_exists.out b/src/test/regress/expected/drop_if_exists.out
new file mode 100644
index 0000000000..10feb3f986
--- /dev/null
+++ b/src/test/regress/expected/drop_if_exists.out
@@ -0,0 +1,67 @@
+--
+-- IF EXISTS tests
+--
+-- table (will be really dropped at the end)
+DROP TABLE test_exists;
+ERROR: table "test_exists" does not exist
+DROP TABLE IF EXISTS test_exists;
+NOTICE: table "test_exists" does not exist, skipping
+CREATE TABLE test_exists (a int, b text);
+-- view
+DROP VIEW test_view_exists;
+ERROR: view "test_view_exists" does not exist
+DROP VIEW IF EXISTS test_view_exists;
+NOTICE: view "test_view_exists" does not exist, skipping
+CREATE VIEW test_view_exists AS select * from test_exists;
+DROP VIEW IF EXISTS test_view_exists;
+DROP VIEW test_view_exists;
+ERROR: view "test_view_exists" does not exist
+-- index
+DROP INDEX test_index_exists;
+ERROR: index "test_index_exists" does not exist
+DROP INDEX IF EXISTS test_index_exists;
+NOTICE: index "test_index_exists" does not exist, skipping
+CREATE INDEX test_index_exists on test_exists(a);
+DROP INDEX IF EXISTS test_index_exists;
+DROP INDEX test_index_exists;
+ERROR: index "test_index_exists" does not exist
+-- sequence
+DROP SEQUENCE test_sequence_exists;
+ERROR: sequence "test_sequence_exists" does not exist
+DROP SEQUENCE IF EXISTS test_sequence_exists;
+NOTICE: sequence "test_sequence_exists" does not exist, skipping
+CREATE SEQUENCE test_sequence_exists;
+DROP SEQUENCE IF EXISTS test_sequence_exists;
+DROP SEQUENCE test_sequence_exists;
+ERROR: sequence "test_sequence_exists" does not exist
+-- schema
+DROP SCHEMA test_schema_exists;
+ERROR: schema "test_schema_exists" does not exist
+DROP SCHEMA IF EXISTS test_schema_exists;
+NOTICE: schema "test_schema_exists" does not exist, skipping
+CREATE SCHEMA test_schema_exists;
+DROP SCHEMA IF EXISTS test_schema_exists;
+DROP SCHEMA test_schema_exists;
+ERROR: schema "test_schema_exists" does not exist
+-- type
+DROP TYPE test_type_exists;
+ERROR: type "test_type_exists" does not exist
+DROP TYPE IF EXISTS test_type_exists;
+NOTICE: type "test_type_exists" does not exist, skipping
+CREATE type test_type_exists as (a int, b text);
+DROP TYPE IF EXISTS test_type_exists;
+DROP TYPE test_type_exists;
+ERROR: type "test_type_exists" does not exist
+-- domain
+DROP DOMAIN test_domain_exists;
+ERROR: type "test_domain_exists" does not exist
+DROP DOMAIN IF EXISTS test_domain_exists;
+NOTICE: type "test_domain_exists" does not exist, skipping
+CREATE domain test_domain_exists as int not null check (value > 0);
+DROP DOMAIN IF EXISTS test_domain_exists;
+DROP DOMAIN test_domain_exists;
+ERROR: type "test_domain_exists" does not exist
+-- drop the table
+DROP TABLE IF EXISTS test_exists;
+DROP TABLE test_exists;
+ERROR: table "test_exists" does not exist
diff --git a/src/test/regress/parallel_schedule b/src/test/regress/parallel_schedule
index 3e52f6f558..d5777794bf 100644
--- a/src/test/regress/parallel_schedule
+++ b/src/test/regress/parallel_schedule
@@ -38,7 +38,7 @@ test: copy
# ----------
# The third group of parallel test
# ----------
-test: constraints triggers create_misc create_aggregate create_operator inherit vacuum
+test: constraints triggers create_misc create_aggregate create_operator inherit vacuum drop_if_exists
# Depends on the above
test: create_index create_view
diff --git a/src/test/regress/serial_schedule b/src/test/regress/serial_schedule
index bf9517fee2..dd60070433 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.28 2005/07/07 20:40:01 tgl Exp $
+# $PostgreSQL: pgsql/src/test/regress/serial_schedule,v 1.29 2005/11/19 17:39:45 adunstan Exp $
# This should probably be in an order similar to parallel_schedule.
test: boolean
test: char
@@ -49,6 +49,7 @@ test: create_misc
test: create_aggregate
test: create_operator
test: create_index
+test: drop_if_exists
test: inherit
test: vacuum
test: create_view
diff --git a/src/test/regress/sql/drop_if_exists.sql b/src/test/regress/sql/drop_if_exists.sql
new file mode 100644
index 0000000000..7addedaa73
--- /dev/null
+++ b/src/test/regress/sql/drop_if_exists.sql
@@ -0,0 +1,91 @@
+--
+-- IF EXISTS tests
+--
+
+-- table (will be really dropped at the end)
+
+DROP TABLE test_exists;
+
+DROP TABLE IF EXISTS test_exists;
+
+CREATE TABLE test_exists (a int, b text);
+
+-- view
+
+DROP VIEW test_view_exists;
+
+DROP VIEW IF EXISTS test_view_exists;
+
+CREATE VIEW test_view_exists AS select * from test_exists;
+
+DROP VIEW IF EXISTS test_view_exists;
+
+DROP VIEW test_view_exists;
+
+-- index
+
+DROP INDEX test_index_exists;
+
+DROP INDEX IF EXISTS test_index_exists;
+
+CREATE INDEX test_index_exists on test_exists(a);
+
+DROP INDEX IF EXISTS test_index_exists;
+
+DROP INDEX test_index_exists;
+
+-- sequence
+
+DROP SEQUENCE test_sequence_exists;
+
+DROP SEQUENCE IF EXISTS test_sequence_exists;
+
+CREATE SEQUENCE test_sequence_exists;
+
+DROP SEQUENCE IF EXISTS test_sequence_exists;
+
+DROP SEQUENCE test_sequence_exists;
+
+-- schema
+
+DROP SCHEMA test_schema_exists;
+
+DROP SCHEMA IF EXISTS test_schema_exists;
+
+CREATE SCHEMA test_schema_exists;
+
+DROP SCHEMA IF EXISTS test_schema_exists;
+
+DROP SCHEMA test_schema_exists;
+
+-- type
+
+DROP TYPE test_type_exists;
+
+DROP TYPE IF EXISTS test_type_exists;
+
+CREATE type test_type_exists as (a int, b text);
+
+DROP TYPE IF EXISTS test_type_exists;
+
+DROP TYPE test_type_exists;
+
+-- domain
+
+DROP DOMAIN test_domain_exists;
+
+DROP DOMAIN IF EXISTS test_domain_exists;
+
+CREATE domain test_domain_exists as int not null check (value > 0);
+
+DROP DOMAIN IF EXISTS test_domain_exists;
+
+DROP DOMAIN test_domain_exists;
+
+-- drop the table
+
+
+DROP TABLE IF EXISTS test_exists;
+
+DROP TABLE test_exists;
+