mirror of https://github.com/citusdata/citus.git
63 lines
3.4 KiB
Plaintext
63 lines
3.4 KiB
Plaintext
-- Tests that check that our query functionality behaves as expected when the
|
|
-- table schema is modified via ALTER statements.
|
|
SET citus.next_shard_id TO 620000;
|
|
SELECT count(*) FROM customer;
|
|
count
|
|
---------------------------------------------------------------------
|
|
1000
|
|
(1 row)
|
|
|
|
SELECT * FROM customer LIMIT 2;
|
|
c_custkey | c_name | c_address | c_nationkey | c_phone | c_acctbal | c_mktsegment | c_comment
|
|
---------------------------------------------------------------------
|
|
1 | Customer#000000001 | IVhzIApeRb ot,c,E | 15 | 25-989-741-2988 | 711.56 | BUILDING | to the even, regular platelets. regular, ironic epitaphs nag e
|
|
2 | Customer#000000002 | XSTf4,NCwDVaWNe6tEgvwfmRchLXak | 13 | 23-768-687-3665 | 121.65 | AUTOMOBILE | l accounts. blithely ironic theodolites integrate boldly: caref
|
|
(2 rows)
|
|
|
|
ALTER TABLE customer ADD COLUMN new_column1 INTEGER;
|
|
ALTER TABLE customer ADD COLUMN new_column2 INTEGER;
|
|
SELECT count(*) FROM customer;
|
|
count
|
|
---------------------------------------------------------------------
|
|
1000
|
|
(1 row)
|
|
|
|
SELECT * FROM customer LIMIT 2;
|
|
c_custkey | c_name | c_address | c_nationkey | c_phone | c_acctbal | c_mktsegment | c_comment | new_column1 | new_column2
|
|
---------------------------------------------------------------------
|
|
1 | Customer#000000001 | IVhzIApeRb ot,c,E | 15 | 25-989-741-2988 | 711.56 | BUILDING | to the even, regular platelets. regular, ironic epitaphs nag e | |
|
|
2 | Customer#000000002 | XSTf4,NCwDVaWNe6tEgvwfmRchLXak | 13 | 23-768-687-3665 | 121.65 | AUTOMOBILE | l accounts. blithely ironic theodolites integrate boldly: caref | |
|
|
(2 rows)
|
|
|
|
ALTER TABLE customer DROP COLUMN new_column1;
|
|
ALTER TABLE customer DROP COLUMN new_column2;
|
|
SELECT count(*) FROM customer;
|
|
count
|
|
---------------------------------------------------------------------
|
|
1000
|
|
(1 row)
|
|
|
|
SELECT * FROM customer LIMIT 2;
|
|
c_custkey | c_name | c_address | c_nationkey | c_phone | c_acctbal | c_mktsegment | c_comment
|
|
---------------------------------------------------------------------
|
|
1 | Customer#000000001 | IVhzIApeRb ot,c,E | 15 | 25-989-741-2988 | 711.56 | BUILDING | to the even, regular platelets. regular, ironic epitaphs nag e
|
|
2 | Customer#000000002 | XSTf4,NCwDVaWNe6tEgvwfmRchLXak | 13 | 23-768-687-3665 | 121.65 | AUTOMOBILE | l accounts. blithely ironic theodolites integrate boldly: caref
|
|
(2 rows)
|
|
|
|
-- Verify joins work with dropped columns.
|
|
SELECT count(*) FROM customer, orders WHERE c_custkey = o_custkey;
|
|
count
|
|
---------------------------------------------------------------------
|
|
1956
|
|
(1 row)
|
|
|
|
-- Test joinExpr aliases by performing an outer-join. This code path is
|
|
-- currently not exercised, but we are adding this test to catch this bug when
|
|
-- we start supporting outer joins.
|
|
SELECT c_custkey
|
|
FROM (customer LEFT OUTER JOIN orders ON (c_custkey = o_custkey)) AS
|
|
test(c_custkey, c_nationkey)
|
|
INNER JOIN lineitem ON (test.c_custkey = l_orderkey)
|
|
LIMIT 10;
|
|
ERROR: complex joins are only supported when all distributed tables are co-located and joined on their distribution columns
|