mirror of https://github.com/citusdata/citus.git
more test fixes........
parent
fd6b4aeba2
commit
c49acc948a
|
@ -143,7 +143,8 @@ cstore_beginscan(Relation relation, Snapshot snapshot,
|
|||
Var *var = makeVar(varno, varattno, vartype, vartypmod,
|
||||
varcollid, varlevelsup);
|
||||
|
||||
columnList = lappend(columnList, var);
|
||||
if (!tupdesc->attrs[i].attisdropped)
|
||||
columnList = lappend(columnList, var);
|
||||
}
|
||||
|
||||
readState = CStoreBeginRead(relid, tupdesc, columnList, NULL);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--
|
||||
-- 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
|
||||
(1, 2, 3),
|
||||
(4, 5, 6),
|
||||
|
@ -9,7 +9,7 @@ WITH sample_data AS (VALUES
|
|||
)
|
||||
INSERT INTO test_alter_table SELECT * FROM sample_data;
|
||||
-- drop a column
|
||||
ALTER FOREIGN TABLE test_alter_table DROP COLUMN a;
|
||||
ALTER TABLE test_alter_table DROP COLUMN a;
|
||||
-- test analyze
|
||||
ANALYZE test_alter_table;
|
||||
-- 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);
|
||||
-- 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;
|
||||
b | c | d
|
||||
---+---+---
|
||||
|
@ -62,7 +62,7 @@ SELECT * FROM test_alter_table;
|
|||
(5 rows)
|
||||
|
||||
-- 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;
|
||||
b | c | d | e
|
||||
---+---+---+---
|
||||
|
@ -86,7 +86,7 @@ SELECT * from test_alter_table;
|
|||
(6 rows)
|
||||
|
||||
-- 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;
|
||||
b | c | d | e | f
|
||||
---+---+---+---+---------
|
||||
|
@ -112,8 +112,8 @@ SELECT * from test_alter_table;
|
|||
(7 rows)
|
||||
|
||||
-- drop couple of columns
|
||||
ALTER FOREIGN TABLE test_alter_table DROP COLUMN c;
|
||||
ALTER FOREIGN TABLE test_alter_table DROP COLUMN e;
|
||||
ALTER TABLE test_alter_table DROP COLUMN c;
|
||||
ALTER TABLE test_alter_table DROP COLUMN e;
|
||||
ANALYZE test_alter_table;
|
||||
SELECT * from test_alter_table;
|
||||
b | d | f
|
||||
|
@ -140,16 +140,16 @@ SELECT count(t.*) from test_alter_table t;
|
|||
(1 row)
|
||||
|
||||
-- unsupported default values
|
||||
ALTER FOREIGN 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 g boolean DEFAULT isfinite(current_date);
|
||||
ALTER TABLE test_alter_table ADD COLUMN h DATE DEFAULT current_date;
|
||||
SELECT * FROM test_alter_table;
|
||||
ERROR: unsupported default value for column "g"
|
||||
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;
|
||||
ERROR: unsupported default value for column "h"
|
||||
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;
|
||||
SELECT * FROM test_alter_table;
|
||||
b | d | f | g | h
|
||||
|
@ -164,15 +164,14 @@ SELECT * FROM test_alter_table;
|
|||
(7 rows)
|
||||
|
||||
-- unsupported type change
|
||||
ALTER FOREIGN TABLE test_alter_table ADD COLUMN i int;
|
||||
ALTER FOREIGN 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 i int;
|
||||
ALTER TABLE test_alter_table ADD COLUMN j float;
|
||||
ALTER TABLE test_alter_table ADD COLUMN k text;
|
||||
-- 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
|
||||
ALTER FOREIGN TABLE test_alter_table ALTER COLUMN j TYPE int;
|
||||
ERROR: Column j cannot be cast automatically to type pg_catalog.int4
|
||||
ALTER TABLE test_alter_table ALTER COLUMN j TYPE int;
|
||||
-- text / varchar conversion is valid both ways
|
||||
ALTER FOREIGN TABLE test_alter_table ALTER COLUMN k TYPE varchar(20);
|
||||
ALTER FOREIGN TABLE test_alter_table ALTER COLUMN k TYPE text;
|
||||
DROP FOREIGN TABLE test_alter_table;
|
||||
ALTER TABLE test_alter_table ALTER COLUMN k TYPE varchar(20);
|
||||
ALTER TABLE test_alter_table ALTER COLUMN k TYPE text;
|
||||
DROP TABLE test_alter_table;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
--
|
||||
-- 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[])
|
||||
SERVER cstore_server;
|
||||
USING cstore_tableam;
|
||||
-- load table data from file
|
||||
COPY test_contestant FROM '/Users/jefdavi/wd/cstore2/data/contestants.1.csv' WITH CSV;
|
||||
-- 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}
|
||||
d 05-05-1985 2314 98.3 XB {}
|
||||
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)
|
||||
|
||||
-- CREATE a cstore_fdw table, fill with some data --
|
||||
CREATE FOREIGN TABLE cstore_truncate_test (a int, b int) SERVER cstore_server;
|
||||
CREATE FOREIGN TABLE cstore_truncate_test_second (a int, b int) SERVER cstore_server;
|
||||
CREATE FOREIGN TABLE cstore_truncate_test_compressed (a int, b int) SERVER cstore_server OPTIONS (compression 'pglz');
|
||||
CREATE TABLE cstore_truncate_test (a int, b int) USING cstore_tableam;
|
||||
CREATE TABLE cstore_truncate_test_second (a int, b int) USING cstore_tableam;
|
||||
CREATE TABLE cstore_truncate_test_compressed (a int, b int) USING cstore_tableam;
|
||||
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_compressed select a, a from generate_series(1, 10) a;
|
||||
|
@ -58,10 +58,10 @@ SELECT count(*) FROM cstore_truncate_test_compressed;
|
|||
0
|
||||
(1 row)
|
||||
|
||||
SELECT cstore_table_size('cstore_truncate_test_compressed');
|
||||
cstore_table_size
|
||||
-------------------
|
||||
0
|
||||
SELECT pg_relation_size('cstore_truncate_test_compressed');
|
||||
pg_relation_size
|
||||
------------------
|
||||
0
|
||||
(1 row)
|
||||
|
||||
INSERT INTO cstore_truncate_test select a, a from generate_series(1, 10) a;
|
||||
|
@ -163,12 +163,12 @@ SELECT cstore_truncate_test_regular_func();
|
|||
(1 row)
|
||||
|
||||
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 FOREIGN TABLE cstore_truncate_test_compressed;
|
||||
DROP TABLE cstore_truncate_test_compressed;
|
||||
-- test truncate with 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);
|
||||
SELECT COUNT(*) FROM truncate_schema.truncate_tbl;
|
||||
count
|
||||
|
@ -227,5 +227,5 @@ SELECT count(*) FROM truncate_schema.truncate_tbl;
|
|||
\c - :current_user
|
||||
-- cleanup
|
||||
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;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
--
|
||||
-- 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[])
|
||||
SERVER cstore_server;
|
||||
USING cstore_tableam;
|
||||
-- load table data from file
|
||||
COPY test_contestant FROM '@abs_srcdir@/data/contestants.1.csv' WITH CSV;
|
||||
-- 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}
|
||||
d 05-05-1985 2314 98.3 XB {}
|
||||
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