more tests...

merge-cstore-pykello
Jeff Davis 2020-09-15 17:49:45 -07:00
parent 7ba75fc2a6
commit fd6b4aeba2
4 changed files with 17 additions and 25 deletions

View File

@ -1,7 +1,7 @@
-- --
-- Tests the different DROP commands for cstore_fdw tables. -- Tests the different DROP commands for cstore_fdw tables.
-- --
-- DROP FOREIGN TABL -- DROP TABL
-- DROP SCHEMA -- DROP SCHEMA
-- DROP EXTENSION -- DROP EXTENSION
-- DROP DATABASE -- DROP DATABASE
@ -13,28 +13,24 @@
-- store postgres database oid -- store postgres database oid
SELECT oid postgres_oid FROM pg_database WHERE datname = 'postgres' \gset SELECT oid postgres_oid FROM pg_database WHERE datname = 'postgres' \gset
-- DROP cstore_fdw tables -- DROP cstore_fdw tables
DROP FOREIGN TABLE contestant; DROP TABLE contestant;
DROP FOREIGN TABLE contestant_compressed; DROP TABLE contestant_compressed;
-- Create a cstore_fdw table under a schema and drop it. -- Create a cstore_fdw table under a schema and drop it.
CREATE SCHEMA test_schema; 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; 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 SELECT current_database() datname \gset
CREATE DATABASE db_to_drop; CREATE DATABASE db_to_drop;
\c db_to_drop \c db_to_drop
CREATE EXTENSION cstore_fdw; 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 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; DROP EXTENSION cstore_fdw CASCADE;
NOTICE: drop cascades to 2 other objects NOTICE: drop cascades to table test_table
DETAIL: drop cascades to server cstore_server
drop cascades to foreign table test_table
-- test database drop -- test database drop
CREATE EXTENSION cstore_fdw; 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 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 \c :datname
DROP DATABASE db_to_drop; DROP DATABASE db_to_drop;

View File

@ -1,7 +1,7 @@
-- --
-- Testing insert on cstore_fdw tables. -- 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 -- test single row inserts fail
select count(*) from test_insert_command; select count(*) from test_insert_command;
count count
@ -10,19 +10,17 @@ select count(*) from test_insert_command;
(1 row) (1 row)
insert into test_insert_command values(1); insert into test_insert_command values(1);
ERROR: operation is not supported
select count(*) from test_insert_command; select count(*) from test_insert_command;
count count
------- -------
0 1
(1 row) (1 row)
insert into test_insert_command default values; insert into test_insert_command default values;
ERROR: operation is not supported
select count(*) from test_insert_command; select count(*) from test_insert_command;
count count
------- -------
0 2
(1 row) (1 row)
-- test inserting from another table succeed -- 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; select count(*) from test_insert_command;
count count
------- -------
1 3
(1 row) (1 row)
drop table test_insert_command_data; drop table test_insert_command_data;
drop foreign table test_insert_command; drop table test_insert_command;
-- test long attribute value insertion -- test long attribute value insertion
-- create sufficiently long text so that data is stored in toast -- create sufficiently long text so that data is stored in toast
CREATE TABLE test_long_text AS CREATE TABLE test_long_text AS
@ -59,8 +57,8 @@ GROUP BY a ORDER BY a;
CREATE TABLE test_long_text_hash AS CREATE TABLE test_long_text_hash AS
SELECT int_val, md5(text_val) AS hash SELECT int_val, md5(text_val) AS hash
FROM test_long_text; FROM test_long_text;
CREATE FOREIGN TABLE test_cstore_long_text(int_val int, text_val text) CREATE TABLE test_cstore_long_text(int_val int, text_val text)
SERVER cstore_server; USING cstore_tableam;
-- store long text in cstore table -- store long text in cstore table
INSERT INTO test_cstore_long_text SELECT * FROM test_long_text; INSERT INTO test_cstore_long_text SELECT * FROM test_long_text;
-- drop source table to remove original text from toast -- 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) (10 rows)
DROP TABLE test_long_text_hash; DROP TABLE test_long_text_hash;
DROP FOREIGN TABLE test_cstore_long_text; DROP TABLE test_cstore_long_text;

View File

@ -29,7 +29,6 @@ SELECT current_database() datname \gset
CREATE DATABASE db_to_drop; CREATE DATABASE db_to_drop;
\c db_to_drop \c db_to_drop
CREATE EXTENSION cstore_fdw; CREATE EXTENSION cstore_fdw;
CREATE USING cstore_tableam DATA WRAPPER cstore_fdw;
SELECT oid::text databaseoid FROM pg_database WHERE datname = current_database() \gset SELECT oid::text databaseoid FROM pg_database WHERE datname = current_database() \gset
CREATE TABLE test_table(data int) USING cstore_tableam; CREATE TABLE test_table(data int) USING cstore_tableam;
@ -38,7 +37,6 @@ DROP EXTENSION cstore_fdw CASCADE;
-- test database drop -- test database drop
CREATE EXTENSION cstore_fdw; CREATE EXTENSION cstore_fdw;
CREATE USING cstore_tableam DATA WRAPPER cstore_fdw;
SELECT oid::text databaseoid FROM pg_database WHERE datname = current_database() \gset SELECT oid::text databaseoid FROM pg_database WHERE datname = current_database() \gset
CREATE TABLE test_table(data int) USING cstore_tableam; CREATE TABLE test_table(data int) USING cstore_tableam;

View File

@ -23,7 +23,7 @@ insert into test_insert_command select * from test_insert_command_data;
select count(*) from test_insert_command; select count(*) from test_insert_command;
drop table test_insert_command_data; drop table test_insert_command_data;
drop foreign table test_insert_command; drop table test_insert_command;
-- test long attribute value insertion -- test long attribute value insertion
-- create sufficiently long text so that data is stored in toast -- create sufficiently long text so that data is stored in toast