ClickHouse/dbms/tests/queries/0_stateless/00604_shard_remote_and_columns_with_defaults.sql

39 lines
1.4 KiB
MySQL
Raw Normal View History

2018-03-12 18:38:24 +00:00
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
DROP TABLE IF EXISTS test.t3;
DROP TABLE IF EXISTS test.t4;
CREATE TABLE test.t1(x UInt32, y UInt32) ENGINE TinyLog;
CREATE TABLE test.t2(x UInt32, y UInt32 DEFAULT x + 1) ENGINE TinyLog;
CREATE TABLE test.t3(x UInt32, y UInt32 MATERIALIZED x + 1) ENGINE TinyLog;
CREATE TABLE test.t4(x UInt32, y UInt32 ALIAS x + 1) ENGINE TinyLog;
INSERT INTO test.t1 VALUES (1, 1);
INSERT INTO test.t2 VALUES (1, 1);
INSERT INTO test.t3 VALUES (1);
INSERT INTO test.t4 VALUES (1);
INSERT INTO FUNCTION remote('127.0.0.2', test.t1) VALUES (2, 2);
INSERT INTO FUNCTION remote('127.0.0.2', test.t2) VALUES (2, 2);
--TODO: INSERT into remote tables with MATERIALIZED columns.
--INSERT INTO FUNCTION remote('127.0.0.2', test.t3) VALUES (2);
INSERT INTO FUNCTION remote('127.0.0.2', test.t4) VALUES (2);
2018-03-14 12:30:39 +00:00
SELECT * FROM remote('127.0.0.2', test.t1) ORDER BY x;
2018-03-12 18:38:24 +00:00
SELECT '*** With a DEFAULT column ***';
2018-03-14 12:30:39 +00:00
SELECT * FROM remote('127.0.0.2', test.t2) ORDER BY x;
2018-03-12 18:38:24 +00:00
SELECT '*** With a MATERIALIZED column ***';
2018-03-14 12:30:39 +00:00
SELECT * FROM remote('127.0.0.2', test.t3) ORDER BY x;
SELECT x, y FROM remote('127.0.0.2', test.t3) ORDER BY x;
2018-03-12 18:38:24 +00:00
SELECT '*** With an ALIAS column ***';
2018-03-14 12:30:39 +00:00
SELECT * FROM remote('127.0.0.2', test.t4) ORDER BY x;
SELECT x, y FROM remote('127.0.0.2', test.t4) ORDER BY x;
2018-03-12 18:38:24 +00:00
2018-03-14 12:30:39 +00:00
DROP TABLE test.t1;
DROP TABLE test.t2;
DROP TABLE test.t3;
DROP TABLE test.t4;