more tests pass

merge-cstore-pykello
Jeff Davis 2020-09-15 17:43:00 -07:00
parent 83f2d4aef2
commit 7ba75fc2a6
7 changed files with 42 additions and 40 deletions

View File

@ -6,8 +6,8 @@ SET datestyle = "ISO, YMD";
SET timezone to 'GMT';
SET intervalstyle TO 'POSTGRES_VERBOSE';
-- Test array types
CREATE FOREIGN TABLE test_array_types (int_array int[], bigint_array bigint[],
text_array text[]) SERVER cstore_server;
CREATE TABLE test_array_types (int_array int[], bigint_array bigint[],
text_array text[]) USING cstore_tableam;
COPY test_array_types FROM '/Users/jefdavi/wd/cstore2/data/array_types.csv' WITH CSV;
SELECT * FROM test_array_types;
int_array | bigint_array | text_array
@ -18,9 +18,9 @@ SELECT * FROM test_array_types;
(3 rows)
-- Test date/time types
CREATE FOREIGN TABLE test_datetime_types (timestamp timestamp,
CREATE TABLE test_datetime_types (timestamp timestamp,
timestamp_with_timezone timestamp with time zone, date date, time time,
interval interval) SERVER cstore_server;
interval interval) USING cstore_tableam;
COPY test_datetime_types FROM '/Users/jefdavi/wd/cstore2/data/datetime_types.csv' WITH CSV;
SELECT * FROM test_datetime_types;
timestamp | timestamp_with_timezone | date | time | interval
@ -32,8 +32,8 @@ SELECT * FROM test_datetime_types;
-- Test enum and composite types
CREATE TYPE enum_type AS ENUM ('a', 'b', 'c');
CREATE TYPE composite_type AS (a int, b text);
CREATE FOREIGN TABLE test_enum_and_composite_types (enum enum_type,
composite composite_type) SERVER cstore_server;
CREATE TABLE test_enum_and_composite_types (enum enum_type,
composite composite_type) USING cstore_tableam;
COPY test_enum_and_composite_types FROM
'/Users/jefdavi/wd/cstore2/data/enum_and_composite_types.csv' WITH CSV;
SELECT * FROM test_enum_and_composite_types;
@ -44,8 +44,8 @@ SELECT * FROM test_enum_and_composite_types;
(2 rows)
-- Test range types
CREATE FOREIGN TABLE test_range_types (int4range int4range, int8range int8range,
numrange numrange, tsrange tsrange) SERVER cstore_server;
CREATE TABLE test_range_types (int4range int4range, int8range int8range,
numrange numrange, tsrange tsrange) USING cstore_tableam;
COPY test_range_types FROM '/Users/jefdavi/wd/cstore2/data/range_types.csv' WITH CSV;
SELECT * FROM test_range_types;
int4range | int8range | numrange | tsrange
@ -55,8 +55,8 @@ SELECT * FROM test_range_types;
(2 rows)
-- Test other types
CREATE FOREIGN TABLE test_other_types (bool boolean, bytea bytea, money money,
inet inet, bitstring bit varying(5), uuid uuid, json json) SERVER cstore_server;
CREATE TABLE test_other_types (bool boolean, bytea bytea, money money,
inet inet, bitstring bit varying(5), uuid uuid, json json) USING cstore_tableam;
COPY test_other_types FROM '/Users/jefdavi/wd/cstore2/data/other_types.csv' WITH CSV;
SELECT * FROM test_other_types;
bool | bytea | money | inet | bitstring | uuid | json
@ -66,8 +66,8 @@ SELECT * FROM test_other_types;
(2 rows)
-- Test null values
CREATE FOREIGN TABLE test_null_values (a int, b int[], c composite_type)
SERVER cstore_server;
CREATE TABLE test_null_values (a int, b int[], c composite_type)
USING cstore_tableam;
COPY test_null_values FROM '/Users/jefdavi/wd/cstore2/data/null_values.csv' WITH CSV;
SELECT * FROM test_null_values;
a | b | c

View File

@ -1,11 +1,11 @@
--
-- Test utility functions for cstore_fdw tables.
--
CREATE FOREIGN TABLE empty_table (a int) SERVER cstore_server;
CREATE FOREIGN TABLE table_with_data (a int) SERVER cstore_server;
CREATE TABLE empty_table (a int) USING cstore_tableam;
CREATE TABLE table_with_data (a int) USING cstore_tableam;
CREATE TABLE non_cstore_table (a int);
COPY table_with_data FROM STDIN;
SELECT cstore_table_size('empty_table') < cstore_table_size('table_with_data');
SELECT pg_relation_size('empty_table') < pg_relation_size('table_with_data');
?column?
----------
t
@ -13,6 +13,6 @@ SELECT cstore_table_size('empty_table') < cstore_table_size('table_with_data');
SELECT cstore_table_size('non_cstore_table');
ERROR: relation is not a cstore table
DROP FOREIGN TABLE empty_table;
DROP FOREIGN TABLE table_with_data;
DROP TABLE empty_table;
DROP TABLE table_with_data;
DROP TABLE non_cstore_table;

View File

@ -5,6 +5,7 @@
COPY contestant FROM '/Users/jefdavi/wd/cstore2/data/contestants.1.csv'
WITH DELIMITER '|'; -- ERROR
ERROR: missing data for column "birthdate"
CONTEXT: COPY contestant, line 1: "a,1990-01-10,2090,97.1,XA ,{a}"
-- COPY with invalid program
COPY contestant FROM PROGRAM 'invalid_program' WITH CSV; -- ERROR
ERROR: program "invalid_program" failed
@ -19,8 +20,8 @@ COPY contestant_compressed FROM '/Users/jefdavi/wd/cstore2/data/contestants.1.cs
COPY contestant_compressed FROM PROGRAM 'cat /Users/jefdavi/wd/cstore2/data/contestants.2.csv'
WITH CSV;
-- Test column list
CREATE FOREIGN TABLE famous_constants (id int, name text, value real)
SERVER cstore_server;
CREATE TABLE famous_constants (id int, name text, value real)
USING cstore_tableam;
COPY famous_constants (value, name, id) FROM STDIN WITH CSV;
COPY famous_constants (name, value) FROM STDIN WITH CSV;
SELECT * FROM famous_constants ORDER BY id, name;
@ -36,4 +37,4 @@ SELECT * FROM famous_constants ORDER BY id, name;
| speed of light | 2.997e+08
(8 rows)
DROP FOREIGN TABLE famous_constants;
DROP TABLE famous_constants;

View File

@ -83,8 +83,8 @@ SELECT to_json(v) FROM contestant v ORDER BY rating LIMIT 1;
(1 row)
-- Test variables used in expressions
CREATE FOREIGN TABLE union_first (a int, b int) SERVER cstore_server;
CREATE FOREIGN TABLE union_second (a int, b int) SERVER cstore_server;
CREATE TABLE union_first (a int, b int) USING cstore_tableam;
CREATE TABLE union_second (a int, b int) USING cstore_tableam;
INSERT INTO union_first SELECT a, a FROM generate_series(1, 5) a;
INSERT INTO union_second SELECT a, a FROM generate_series(11, 15) a;
(SELECT a*1, b FROM union_first) union all (SELECT a*1, b FROM union_second);
@ -102,4 +102,4 @@ INSERT INTO union_second SELECT a, a FROM generate_series(11, 15) a;
15 | 15
(10 rows)
DROP FOREIGN TABLE union_first, union_second;
DROP TABLE union_first, union_second;

View File

@ -6,8 +6,8 @@ SET datestyle = "ISO, YMD";
SET timezone to 'GMT';
SET intervalstyle TO 'POSTGRES_VERBOSE';
-- Test array types
CREATE FOREIGN TABLE test_array_types (int_array int[], bigint_array bigint[],
text_array text[]) SERVER cstore_server;
CREATE TABLE test_array_types (int_array int[], bigint_array bigint[],
text_array text[]) USING cstore_tableam;
COPY test_array_types FROM '@abs_srcdir@/data/array_types.csv' WITH CSV;
SELECT * FROM test_array_types;
int_array | bigint_array | text_array
@ -18,9 +18,9 @@ SELECT * FROM test_array_types;
(3 rows)
-- Test date/time types
CREATE FOREIGN TABLE test_datetime_types (timestamp timestamp,
CREATE TABLE test_datetime_types (timestamp timestamp,
timestamp_with_timezone timestamp with time zone, date date, time time,
interval interval) SERVER cstore_server;
interval interval) USING cstore_tableam;
COPY test_datetime_types FROM '@abs_srcdir@/data/datetime_types.csv' WITH CSV;
SELECT * FROM test_datetime_types;
timestamp | timestamp_with_timezone | date | time | interval
@ -32,8 +32,8 @@ SELECT * FROM test_datetime_types;
-- Test enum and composite types
CREATE TYPE enum_type AS ENUM ('a', 'b', 'c');
CREATE TYPE composite_type AS (a int, b text);
CREATE FOREIGN TABLE test_enum_and_composite_types (enum enum_type,
composite composite_type) SERVER cstore_server;
CREATE TABLE test_enum_and_composite_types (enum enum_type,
composite composite_type) USING cstore_tableam;
COPY test_enum_and_composite_types FROM
'@abs_srcdir@/data/enum_and_composite_types.csv' WITH CSV;
SELECT * FROM test_enum_and_composite_types;
@ -44,8 +44,8 @@ SELECT * FROM test_enum_and_composite_types;
(2 rows)
-- Test range types
CREATE FOREIGN TABLE test_range_types (int4range int4range, int8range int8range,
numrange numrange, tsrange tsrange) SERVER cstore_server;
CREATE TABLE test_range_types (int4range int4range, int8range int8range,
numrange numrange, tsrange tsrange) USING cstore_tableam;
COPY test_range_types FROM '@abs_srcdir@/data/range_types.csv' WITH CSV;
SELECT * FROM test_range_types;
int4range | int8range | numrange | tsrange
@ -55,8 +55,8 @@ SELECT * FROM test_range_types;
(2 rows)
-- Test other types
CREATE FOREIGN TABLE test_other_types (bool boolean, bytea bytea, money money,
inet inet, bitstring bit varying(5), uuid uuid, json json) SERVER cstore_server;
CREATE TABLE test_other_types (bool boolean, bytea bytea, money money,
inet inet, bitstring bit varying(5), uuid uuid, json json) USING cstore_tableam;
COPY test_other_types FROM '@abs_srcdir@/data/other_types.csv' WITH CSV;
SELECT * FROM test_other_types;
bool | bytea | money | inet | bitstring | uuid | json
@ -66,8 +66,8 @@ SELECT * FROM test_other_types;
(2 rows)
-- Test null values
CREATE FOREIGN TABLE test_null_values (a int, b int[], c composite_type)
SERVER cstore_server;
CREATE TABLE test_null_values (a int, b int[], c composite_type)
USING cstore_tableam;
COPY test_null_values FROM '@abs_srcdir@/data/null_values.csv' WITH CSV;
SELECT * FROM test_null_values;
a | b | c

View File

@ -5,6 +5,7 @@
COPY contestant FROM '@abs_srcdir@/data/contestants.1.csv'
WITH DELIMITER '|'; -- ERROR
ERROR: missing data for column "birthdate"
CONTEXT: COPY contestant, line 1: "a,1990-01-10,2090,97.1,XA ,{a}"
-- COPY with invalid program
COPY contestant FROM PROGRAM 'invalid_program' WITH CSV; -- ERROR
ERROR: program "invalid_program" failed
@ -19,8 +20,8 @@ COPY contestant_compressed FROM '@abs_srcdir@/data/contestants.1.csv' WITH CSV;
COPY contestant_compressed FROM PROGRAM 'cat @abs_srcdir@/data/contestants.2.csv'
WITH CSV;
-- Test column list
CREATE FOREIGN TABLE famous_constants (id int, name text, value real)
SERVER cstore_server;
CREATE TABLE famous_constants (id int, name text, value real)
USING cstore_tableam;
COPY famous_constants (value, name, id) FROM STDIN WITH CSV;
COPY famous_constants (name, value) FROM STDIN WITH CSV;
SELECT * FROM famous_constants ORDER BY id, name;
@ -36,4 +37,4 @@ SELECT * FROM famous_constants ORDER BY id, name;
| speed of light | 2.997e+08
(8 rows)
DROP FOREIGN TABLE famous_constants;
DROP TABLE famous_constants;

View File

@ -12,8 +12,8 @@ COPY table_with_data FROM STDIN;
3
\.
SELECT pg_relation_size('empty_table') < cstore_table_size('table_with_data');
SELECT pg_relation_size('non_cstore_table');
SELECT pg_relation_size('empty_table') < pg_relation_size('table_with_data');
SELECT cstore_table_size('non_cstore_table');
DROP TABLE empty_table;
DROP TABLE table_with_data;