From fd6b4aeba2bf141bb65ec9c067066f234df7273b Mon Sep 17 00:00:00 2001 From: Jeff Davis Date: Tue, 15 Sep 2020 17:49:45 -0700 Subject: [PATCH] more tests... --- expected/am_drop.out | 20 ++++++++------------ expected/am_insert.out | 18 ++++++++---------- sql/am_drop.sql | 2 -- sql/am_insert.sql | 2 +- 4 files changed, 17 insertions(+), 25 deletions(-) diff --git a/expected/am_drop.out b/expected/am_drop.out index 926f69337..e1c634d7f 100644 --- a/expected/am_drop.out +++ b/expected/am_drop.out @@ -1,7 +1,7 @@ -- -- Tests the different DROP commands for cstore_fdw tables. -- --- DROP FOREIGN TABL +-- DROP TABL -- DROP SCHEMA -- DROP EXTENSION -- DROP DATABASE @@ -13,28 +13,24 @@ -- store postgres database oid SELECT oid postgres_oid FROM pg_database WHERE datname = 'postgres' \gset -- DROP cstore_fdw tables -DROP FOREIGN TABLE contestant; -DROP FOREIGN TABLE contestant_compressed; +DROP TABLE contestant; +DROP TABLE contestant_compressed; -- Create a cstore_fdw table under a schema and drop it. CREATE SCHEMA test_schema; -CREATE FOREIGN TABLE test_schema.test_table(data int) SERVER cstore_server; +CREATE TABLE test_schema.test_table(data int) USING cstore_tableam; DROP SCHEMA test_schema CASCADE; -NOTICE: drop cascades to foreign table test_schema.test_table +NOTICE: drop cascades to table test_schema.test_table SELECT current_database() datname \gset CREATE DATABASE db_to_drop; \c db_to_drop CREATE EXTENSION cstore_fdw; -CREATE SERVER cstore_server FOREIGN DATA WRAPPER cstore_fdw; SELECT oid::text databaseoid FROM pg_database WHERE datname = current_database() \gset -CREATE FOREIGN TABLE test_table(data int) SERVER cstore_server; +CREATE TABLE test_table(data int) USING cstore_tableam; DROP EXTENSION cstore_fdw CASCADE; -NOTICE: drop cascades to 2 other objects -DETAIL: drop cascades to server cstore_server -drop cascades to foreign table test_table +NOTICE: drop cascades to table test_table -- test database drop CREATE EXTENSION cstore_fdw; -CREATE SERVER cstore_server FOREIGN DATA WRAPPER cstore_fdw; SELECT oid::text databaseoid FROM pg_database WHERE datname = current_database() \gset -CREATE FOREIGN TABLE test_table(data int) SERVER cstore_server; +CREATE TABLE test_table(data int) USING cstore_tableam; \c :datname DROP DATABASE db_to_drop; diff --git a/expected/am_insert.out b/expected/am_insert.out index 49d9ed132..8d06d4323 100644 --- a/expected/am_insert.out +++ b/expected/am_insert.out @@ -1,7 +1,7 @@ -- -- Testing insert on cstore_fdw tables. -- -CREATE FOREIGN TABLE test_insert_command (a int) SERVER cstore_server; +CREATE TABLE test_insert_command (a int) USING cstore_tableam; -- test single row inserts fail select count(*) from test_insert_command; count @@ -10,19 +10,17 @@ select count(*) from test_insert_command; (1 row) insert into test_insert_command values(1); -ERROR: operation is not supported select count(*) from test_insert_command; count ------- - 0 + 1 (1 row) insert into test_insert_command default values; -ERROR: operation is not supported select count(*) from test_insert_command; count ------- - 0 + 2 (1 row) -- test inserting from another table succeed @@ -44,11 +42,11 @@ insert into test_insert_command select * from test_insert_command_data; select count(*) from test_insert_command; count ------- - 1 + 3 (1 row) drop table test_insert_command_data; -drop foreign table test_insert_command; +drop table test_insert_command; -- test long attribute value insertion -- create sufficiently long text so that data is stored in toast CREATE TABLE test_long_text AS @@ -59,8 +57,8 @@ GROUP BY a ORDER BY a; CREATE TABLE test_long_text_hash AS SELECT int_val, md5(text_val) AS hash FROM test_long_text; -CREATE FOREIGN TABLE test_cstore_long_text(int_val int, text_val text) -SERVER cstore_server; +CREATE TABLE test_cstore_long_text(int_val int, text_val text) +USING cstore_tableam; -- store long text in cstore table INSERT INTO test_cstore_long_text SELECT * FROM test_long_text; -- drop source table to remove original text from toast @@ -85,4 +83,4 @@ WHERE a.int_val = c.int_val AND a.hash = md5(c.text_val); (10 rows) DROP TABLE test_long_text_hash; -DROP FOREIGN TABLE test_cstore_long_text; +DROP TABLE test_cstore_long_text; diff --git a/sql/am_drop.sql b/sql/am_drop.sql index 5945a9f2c..f92f90b9d 100644 --- a/sql/am_drop.sql +++ b/sql/am_drop.sql @@ -29,7 +29,6 @@ SELECT current_database() datname \gset CREATE DATABASE db_to_drop; \c db_to_drop CREATE EXTENSION cstore_fdw; -CREATE USING cstore_tableam DATA WRAPPER cstore_fdw; SELECT oid::text databaseoid FROM pg_database WHERE datname = current_database() \gset CREATE TABLE test_table(data int) USING cstore_tableam; @@ -38,7 +37,6 @@ DROP EXTENSION cstore_fdw CASCADE; -- test database drop CREATE EXTENSION cstore_fdw; -CREATE USING cstore_tableam DATA WRAPPER cstore_fdw; SELECT oid::text databaseoid FROM pg_database WHERE datname = current_database() \gset CREATE TABLE test_table(data int) USING cstore_tableam; diff --git a/sql/am_insert.sql b/sql/am_insert.sql index b249828e7..5a6d7d385 100644 --- a/sql/am_insert.sql +++ b/sql/am_insert.sql @@ -23,7 +23,7 @@ insert into test_insert_command select * from test_insert_command_data; select count(*) from test_insert_command; drop table test_insert_command_data; -drop foreign table test_insert_command; +drop table test_insert_command; -- test long attribute value insertion -- create sufficiently long text so that data is stored in toast