mirror of https://github.com/citusdata/citus.git
more test fixes........
parent
fd6b4aeba2
commit
c49acc948a
|
@ -143,6 +143,7 @@ cstore_beginscan(Relation relation, Snapshot snapshot,
|
||||||
Var *var = makeVar(varno, varattno, vartype, vartypmod,
|
Var *var = makeVar(varno, varattno, vartype, vartypmod,
|
||||||
varcollid, varlevelsup);
|
varcollid, varlevelsup);
|
||||||
|
|
||||||
|
if (!tupdesc->attrs[i].attisdropped)
|
||||||
columnList = lappend(columnList, var);
|
columnList = lappend(columnList, var);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
--
|
--
|
||||||
-- Testing ALTER TABLE on cstore_fdw tables.
|
-- Testing ALTER TABLE on cstore_fdw tables.
|
||||||
--
|
--
|
||||||
CREATE FOREIGN TABLE test_alter_table (a int, b int, c int) SERVER cstore_server;
|
CREATE TABLE test_alter_table (a int, b int, c int) USING cstore_tableam;
|
||||||
WITH sample_data AS (VALUES
|
WITH sample_data AS (VALUES
|
||||||
(1, 2, 3),
|
(1, 2, 3),
|
||||||
(4, 5, 6),
|
(4, 5, 6),
|
||||||
|
@ -9,7 +9,7 @@ WITH sample_data AS (VALUES
|
||||||
)
|
)
|
||||||
INSERT INTO test_alter_table SELECT * FROM sample_data;
|
INSERT INTO test_alter_table SELECT * FROM sample_data;
|
||||||
-- drop a column
|
-- drop a column
|
||||||
ALTER FOREIGN TABLE test_alter_table DROP COLUMN a;
|
ALTER TABLE test_alter_table DROP COLUMN a;
|
||||||
-- test analyze
|
-- test analyze
|
||||||
ANALYZE test_alter_table;
|
ANALYZE test_alter_table;
|
||||||
-- verify select queries run as expected
|
-- verify select queries run as expected
|
||||||
|
@ -40,7 +40,7 @@ LINE 1: INSERT INTO test_alter_table (SELECT 3, 5, 8);
|
||||||
^
|
^
|
||||||
INSERT INTO test_alter_table (SELECT 5, 8);
|
INSERT INTO test_alter_table (SELECT 5, 8);
|
||||||
-- add a column with no defaults
|
-- add a column with no defaults
|
||||||
ALTER FOREIGN TABLE test_alter_table ADD COLUMN d int;
|
ALTER TABLE test_alter_table ADD COLUMN d int;
|
||||||
SELECT * FROM test_alter_table;
|
SELECT * FROM test_alter_table;
|
||||||
b | c | d
|
b | c | d
|
||||||
---+---+---
|
---+---+---
|
||||||
|
@ -62,7 +62,7 @@ SELECT * FROM test_alter_table;
|
||||||
(5 rows)
|
(5 rows)
|
||||||
|
|
||||||
-- add a fixed-length column with default value
|
-- add a fixed-length column with default value
|
||||||
ALTER FOREIGN TABLE test_alter_table ADD COLUMN e int default 3;
|
ALTER TABLE test_alter_table ADD COLUMN e int default 3;
|
||||||
SELECT * from test_alter_table;
|
SELECT * from test_alter_table;
|
||||||
b | c | d | e
|
b | c | d | e
|
||||||
---+---+---+---
|
---+---+---+---
|
||||||
|
@ -86,7 +86,7 @@ SELECT * from test_alter_table;
|
||||||
(6 rows)
|
(6 rows)
|
||||||
|
|
||||||
-- add a variable-length column with default value
|
-- add a variable-length column with default value
|
||||||
ALTER FOREIGN TABLE test_alter_table ADD COLUMN f text DEFAULT 'TEXT ME';
|
ALTER TABLE test_alter_table ADD COLUMN f text DEFAULT 'TEXT ME';
|
||||||
SELECT * from test_alter_table;
|
SELECT * from test_alter_table;
|
||||||
b | c | d | e | f
|
b | c | d | e | f
|
||||||
---+---+---+---+---------
|
---+---+---+---+---------
|
||||||
|
@ -112,8 +112,8 @@ SELECT * from test_alter_table;
|
||||||
(7 rows)
|
(7 rows)
|
||||||
|
|
||||||
-- drop couple of columns
|
-- drop couple of columns
|
||||||
ALTER FOREIGN TABLE test_alter_table DROP COLUMN c;
|
ALTER TABLE test_alter_table DROP COLUMN c;
|
||||||
ALTER FOREIGN TABLE test_alter_table DROP COLUMN e;
|
ALTER TABLE test_alter_table DROP COLUMN e;
|
||||||
ANALYZE test_alter_table;
|
ANALYZE test_alter_table;
|
||||||
SELECT * from test_alter_table;
|
SELECT * from test_alter_table;
|
||||||
b | d | f
|
b | d | f
|
||||||
|
@ -140,16 +140,16 @@ SELECT count(t.*) from test_alter_table t;
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- unsupported default values
|
-- unsupported default values
|
||||||
ALTER FOREIGN TABLE test_alter_table ADD COLUMN g boolean DEFAULT isfinite(current_date);
|
ALTER TABLE test_alter_table ADD COLUMN g boolean DEFAULT isfinite(current_date);
|
||||||
ALTER FOREIGN TABLE test_alter_table ADD COLUMN h DATE DEFAULT current_date;
|
ALTER TABLE test_alter_table ADD COLUMN h DATE DEFAULT current_date;
|
||||||
SELECT * FROM test_alter_table;
|
SELECT * FROM test_alter_table;
|
||||||
ERROR: unsupported default value for column "g"
|
ERROR: unsupported default value for column "g"
|
||||||
HINT: Expression is either mutable or does not evaluate to constant value
|
HINT: Expression is either mutable or does not evaluate to constant value
|
||||||
ALTER FOREIGN TABLE test_alter_table ALTER COLUMN g DROP DEFAULT;
|
ALTER TABLE test_alter_table ALTER COLUMN g DROP DEFAULT;
|
||||||
SELECT * FROM test_alter_table;
|
SELECT * FROM test_alter_table;
|
||||||
ERROR: unsupported default value for column "h"
|
ERROR: unsupported default value for column "h"
|
||||||
HINT: Expression is either mutable or does not evaluate to constant value
|
HINT: Expression is either mutable or does not evaluate to constant value
|
||||||
ALTER FOREIGN TABLE test_alter_table ALTER COLUMN h DROP DEFAULT;
|
ALTER TABLE test_alter_table ALTER COLUMN h DROP DEFAULT;
|
||||||
ANALYZE test_alter_table;
|
ANALYZE test_alter_table;
|
||||||
SELECT * FROM test_alter_table;
|
SELECT * FROM test_alter_table;
|
||||||
b | d | f | g | h
|
b | d | f | g | h
|
||||||
|
@ -164,15 +164,14 @@ SELECT * FROM test_alter_table;
|
||||||
(7 rows)
|
(7 rows)
|
||||||
|
|
||||||
-- unsupported type change
|
-- unsupported type change
|
||||||
ALTER FOREIGN TABLE test_alter_table ADD COLUMN i int;
|
ALTER TABLE test_alter_table ADD COLUMN i int;
|
||||||
ALTER FOREIGN TABLE test_alter_table ADD COLUMN j float;
|
ALTER TABLE test_alter_table ADD COLUMN j float;
|
||||||
ALTER FOREIGN TABLE test_alter_table ADD COLUMN k text;
|
ALTER TABLE test_alter_table ADD COLUMN k text;
|
||||||
-- this is valid type change
|
-- this is valid type change
|
||||||
ALTER FOREIGN TABLE test_alter_table ALTER COLUMN i TYPE float;
|
ALTER TABLE test_alter_table ALTER COLUMN i TYPE float;
|
||||||
-- this is not valid
|
-- this is not valid
|
||||||
ALTER FOREIGN TABLE test_alter_table ALTER COLUMN j TYPE int;
|
ALTER TABLE test_alter_table ALTER COLUMN j TYPE int;
|
||||||
ERROR: Column j cannot be cast automatically to type pg_catalog.int4
|
|
||||||
-- text / varchar conversion is valid both ways
|
-- text / varchar conversion is valid both ways
|
||||||
ALTER FOREIGN TABLE test_alter_table ALTER COLUMN k TYPE varchar(20);
|
ALTER TABLE test_alter_table ALTER COLUMN k TYPE varchar(20);
|
||||||
ALTER FOREIGN TABLE test_alter_table ALTER COLUMN k TYPE text;
|
ALTER TABLE test_alter_table ALTER COLUMN k TYPE text;
|
||||||
DROP FOREIGN TABLE test_alter_table;
|
DROP TABLE test_alter_table;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
--
|
--
|
||||||
-- Test copying data from cstore_fdw tables.
|
-- Test copying data from cstore_fdw tables.
|
||||||
--
|
--
|
||||||
CREATE FOREIGN TABLE test_contestant(handle TEXT, birthdate DATE, rating INT,
|
CREATE TABLE test_contestant(handle TEXT, birthdate DATE, rating INT,
|
||||||
percentile FLOAT, country CHAR(3), achievements TEXT[])
|
percentile FLOAT, country CHAR(3), achievements TEXT[])
|
||||||
SERVER cstore_server;
|
USING cstore_tableam;
|
||||||
-- load table data from file
|
-- load table data from file
|
||||||
COPY test_contestant FROM '/Users/jefdavi/wd/cstore2/data/contestants.1.csv' WITH CSV;
|
COPY test_contestant FROM '/Users/jefdavi/wd/cstore2/data/contestants.1.csv' WITH CSV;
|
||||||
-- export using COPY table TO ...
|
-- export using COPY table TO ...
|
||||||
|
@ -20,4 +20,4 @@ b 11-01-1990 2203 98.1 XA {a,b}
|
||||||
c 11-01-1988 2907 99.4 XB {w,y}
|
c 11-01-1988 2907 99.4 XB {w,y}
|
||||||
d 05-05-1985 2314 98.3 XB {}
|
d 05-05-1985 2314 98.3 XB {}
|
||||||
e 05-05-1995 2236 98.2 XC {a}
|
e 05-05-1995 2236 98.2 XC {a}
|
||||||
DROP FOREIGN TABLE test_contestant CASCADE;
|
DROP TABLE test_contestant CASCADE;
|
||||||
|
|
|
@ -10,9 +10,9 @@ SELECT substring(:'server_version', '\d+')::int > 10 AS version_above_ten;
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- CREATE a cstore_fdw table, fill with some data --
|
-- CREATE a cstore_fdw table, fill with some data --
|
||||||
CREATE FOREIGN TABLE cstore_truncate_test (a int, b int) SERVER cstore_server;
|
CREATE TABLE cstore_truncate_test (a int, b int) USING cstore_tableam;
|
||||||
CREATE FOREIGN TABLE cstore_truncate_test_second (a int, b int) SERVER cstore_server;
|
CREATE TABLE cstore_truncate_test_second (a int, b int) USING cstore_tableam;
|
||||||
CREATE FOREIGN TABLE cstore_truncate_test_compressed (a int, b int) SERVER cstore_server OPTIONS (compression 'pglz');
|
CREATE TABLE cstore_truncate_test_compressed (a int, b int) USING cstore_tableam;
|
||||||
CREATE TABLE cstore_truncate_test_regular (a int, b int);
|
CREATE TABLE cstore_truncate_test_regular (a int, b int);
|
||||||
INSERT INTO cstore_truncate_test select a, a from generate_series(1, 10) a;
|
INSERT INTO cstore_truncate_test select a, a from generate_series(1, 10) a;
|
||||||
INSERT INTO cstore_truncate_test_compressed select a, a from generate_series(1, 10) a;
|
INSERT INTO cstore_truncate_test_compressed select a, a from generate_series(1, 10) a;
|
||||||
|
@ -58,9 +58,9 @@ SELECT count(*) FROM cstore_truncate_test_compressed;
|
||||||
0
|
0
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT cstore_table_size('cstore_truncate_test_compressed');
|
SELECT pg_relation_size('cstore_truncate_test_compressed');
|
||||||
cstore_table_size
|
pg_relation_size
|
||||||
-------------------
|
------------------
|
||||||
0
|
0
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -163,12 +163,12 @@ SELECT cstore_truncate_test_regular_func();
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
DROP FUNCTION cstore_truncate_test_regular_func();
|
DROP FUNCTION cstore_truncate_test_regular_func();
|
||||||
DROP FOREIGN TABLE cstore_truncate_test, cstore_truncate_test_second;
|
DROP TABLE cstore_truncate_test, cstore_truncate_test_second;
|
||||||
DROP TABLE cstore_truncate_test_regular;
|
DROP TABLE cstore_truncate_test_regular;
|
||||||
DROP FOREIGN TABLE cstore_truncate_test_compressed;
|
DROP TABLE cstore_truncate_test_compressed;
|
||||||
-- test truncate with schema
|
-- test truncate with schema
|
||||||
CREATE SCHEMA truncate_schema;
|
CREATE SCHEMA truncate_schema;
|
||||||
CREATE FOREIGN TABLE truncate_schema.truncate_tbl (id int) SERVER cstore_server OPTIONS(compression 'pglz');
|
CREATE TABLE truncate_schema.truncate_tbl (id int) USING cstore_tableam;
|
||||||
INSERT INTO truncate_schema.truncate_tbl SELECT generate_series(1, 100);
|
INSERT INTO truncate_schema.truncate_tbl SELECT generate_series(1, 100);
|
||||||
SELECT COUNT(*) FROM truncate_schema.truncate_tbl;
|
SELECT COUNT(*) FROM truncate_schema.truncate_tbl;
|
||||||
count
|
count
|
||||||
|
@ -227,5 +227,5 @@ SELECT count(*) FROM truncate_schema.truncate_tbl;
|
||||||
\c - :current_user
|
\c - :current_user
|
||||||
-- cleanup
|
-- cleanup
|
||||||
DROP SCHEMA truncate_schema CASCADE;
|
DROP SCHEMA truncate_schema CASCADE;
|
||||||
NOTICE: drop cascades to foreign table truncate_schema.truncate_tbl
|
NOTICE: drop cascades to table truncate_schema.truncate_tbl
|
||||||
DROP USER truncate_user;
|
DROP USER truncate_user;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
--
|
--
|
||||||
-- Test copying data from cstore_fdw tables.
|
-- Test copying data from cstore_fdw tables.
|
||||||
--
|
--
|
||||||
CREATE FOREIGN TABLE test_contestant(handle TEXT, birthdate DATE, rating INT,
|
CREATE TABLE test_contestant(handle TEXT, birthdate DATE, rating INT,
|
||||||
percentile FLOAT, country CHAR(3), achievements TEXT[])
|
percentile FLOAT, country CHAR(3), achievements TEXT[])
|
||||||
SERVER cstore_server;
|
USING cstore_tableam;
|
||||||
-- load table data from file
|
-- load table data from file
|
||||||
COPY test_contestant FROM '@abs_srcdir@/data/contestants.1.csv' WITH CSV;
|
COPY test_contestant FROM '@abs_srcdir@/data/contestants.1.csv' WITH CSV;
|
||||||
-- export using COPY table TO ...
|
-- export using COPY table TO ...
|
||||||
|
@ -20,4 +20,4 @@ b 11-01-1990 2203 98.1 XA {a,b}
|
||||||
c 11-01-1988 2907 99.4 XB {w,y}
|
c 11-01-1988 2907 99.4 XB {w,y}
|
||||||
d 05-05-1985 2314 98.3 XB {}
|
d 05-05-1985 2314 98.3 XB {}
|
||||||
e 05-05-1995 2236 98.2 XC {a}
|
e 05-05-1995 2236 98.2 XC {a}
|
||||||
DROP FOREIGN TABLE test_contestant CASCADE;
|
DROP TABLE test_contestant CASCADE;
|
||||||
|
|
Loading…
Reference in New Issue