drop_if_exists.out 4.2 KB
Newer Older
A
 
Andrew Dunstan 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 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
A
 
Andrew Dunstan 已提交
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
---
--- role/user/group
---
CREATE USER tu1;
CREATE ROLE tr1;
CREATE GROUP tg1;
DROP USER tu2;
ERROR:  role "tu2" does not exist
DROP USER IF EXISTS tu1, tu2;
NOTICE:  role "tu2" does not exist, skipping
DROP USER tu1;
ERROR:  role "tu1" does not exist
DROP ROLE tr2;
ERROR:  role "tr2" does not exist
DROP ROLE IF EXISTS tr1, tr2;
NOTICE:  role "tr2" does not exist, skipping
DROP ROLE tr1;
ERROR:  role "tr1" does not exist
DROP GROUP tg2;
ERROR:  role "tg2" does not exist
DROP GROUP IF EXISTS tg1, tg2;
NOTICE:  role "tg2" does not exist, skipping
DROP GROUP tg1;
ERROR:  role "tg1" does not exist
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
--create a schema with the same name as the logged in user name and try to drop and recreate a table
drop database if exists drop_table_test;
NOTICE:  database "drop_table_test" does not exist, skipping
create database drop_table_test;
\c drop_table_test
--get the username and set it to a variable
\set cur_user `echo $USER`
CREATE SCHEMA :cur_user;
CREATE TABLE tbl_to_drop(i int);
NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Greenplum Database data distribution key for this table.
HINT:  The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
DROP TABLE tbl_to_drop;
CREATE TABLE tbl_to_drop(i int);
NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'i' as the Greenplum Database data distribution key for this table.
HINT:  The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
DROP SCHEMA :cur_user CASCADE;
NOTICE:  drop cascades to table tbl_to_drop
\c regression
drop database drop_table_test;