ClickHouse/tests/queries/0_stateless/00969_columns_clause.sql

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
1.3 KiB
MySQL
Raw Normal View History

2019-07-21 02:13:42 +00:00
DROP TABLE IF EXISTS ColumnsClauseTest;
CREATE TABLE ColumnsClauseTest (product_price Int64, product_weight Int16, amount Int64) Engine=TinyLog;
2019-07-12 11:17:38 +00:00
INSERT INTO ColumnsClauseTest VALUES (100, 10, 324), (120, 8, 23);
2019-07-16 20:05:00 +00:00
SELECT COLUMNS('product.*') from ColumnsClauseTest ORDER BY product_price;
2019-07-21 02:13:42 +00:00
DROP TABLE ColumnsClauseTest;
SELECT number, COLUMNS('') FROM numbers(2);
SELECT number, COLUMNS('ber') FROM numbers(2); -- It works for unanchored regular expressions.
SELECT number, COLUMNS('x') FROM numbers(2);
SELECT COLUMNS('') FROM numbers(2);
SELECT COLUMNS('x') FROM numbers(10) WHERE number > 5; -- { serverError 51 }
SELECT * FROM numbers(2) WHERE NOT ignore();
SELECT * FROM numbers(2) WHERE NOT ignore(*);
SELECT * FROM numbers(2) WHERE NOT ignore(COLUMNS('.+'));
SELECT * FROM numbers(2) WHERE NOT ignore(COLUMNS('x'));
SELECT COLUMNS('n') + COLUMNS('u') FROM system.numbers LIMIT 2;
SELECT COLUMNS('n') + COLUMNS('u') FROM (SELECT 1 AS a, 2 AS b); -- { serverError 42 }
SELECT COLUMNS('a') + COLUMNS('b') FROM (SELECT 1 AS a, 2 AS b);
SELECT COLUMNS('a') + COLUMNS('a') FROM (SELECT 1 AS a, 2 AS b);
SELECT COLUMNS('b') + COLUMNS('b') FROM (SELECT 1 AS a, 2 AS b);
SELECT COLUMNS('a|b') + COLUMNS('b') FROM (SELECT 1 AS a, 2 AS b); -- { serverError 42 }
SELECT plus(COLUMNS('^(a|b)$')) FROM (SELECT 1 AS a, 2 AS b);