ClickHouse/tests/queries/0_stateless/03101_analyzer_identifiers_3.sql

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

93 lines
1.8 KiB
MySQL
Raw Normal View History

2024-04-15 15:29:36 +00:00
-- Tags: no-parallel
-- Looks like you cannot use the query parameter as a column name.
-- https://github.com/ClickHouse/ClickHouse/issues/23194
SET allow_experimental_analyzer = 1;
2024-04-15 15:29:36 +00:00
DROP DATABASE IF EXISTS db1_03101;
DROP DATABASE IF EXISTS db2_03101;
CREATE DATABASE db1_03101;
CREATE DATABASE db2_03101;
USE db1_03101;
2024-04-15 15:29:36 +00:00
CREATE TABLE db1_03101.tbl
(
col String,
2024-04-15 15:29:36 +00:00
db1_03101 Nested
(
tbl Nested
(
col String
)
)
)
ENGINE = Memory;
2024-04-15 15:29:36 +00:00
SELECT db1_03101.tbl.col FROM db1_03101.tbl;
2024-04-15 15:29:36 +00:00
SELECT db1_03101.* FROM tbl;
SELECT db1_03101 FROM tbl;
SELECT * FROM tbl;
SELECT count(*) FROM tbl;
SELECT * + * FROM VALUES('a UInt16', 1, 10);
SELECT '---';
SELECT * GROUP BY *;
-- not ok as every component of ORDER BY may contain ASC/DESC and COLLATE; though can be supported in some sense
-- but it works
SELECT * ORDER BY *;
2024-05-08 11:40:17 +00:00
SELECT * WHERE *; -- { serverError BAD_ARGUMENTS }
SELECT '---';
SELECT * FROM (SELECT 1 AS a) AS t, (SELECT 2 AS b) AS u;
-- equivalent to:
SELECT a, b FROM (SELECT 1 AS a) AS t, (SELECT 2 AS b) AS u;
SELECT '---';
SELECT * FROM (SELECT 1 AS a) AS t, (SELECT 1 AS a) AS u;
-- equivalent to:
SELECT t.a, u.a FROM (SELECT 1 AS a) AS t, (SELECT 1 AS a) AS u;
SELECT '---';
---- TODO: think about it
2024-04-15 15:29:36 +00:00
--CREATE TABLE db1_03101.t
--(
-- a UInt16
--)
--ENGINE = Memory;
--
2024-04-15 15:29:36 +00:00
--CREATE TABLE db2_03101.t
--(
-- a UInt16
--)
--ENGINE = Memory;
--
2024-04-15 15:29:36 +00:00
--SELECT * FROM (SELECT 1 AS a) AS db2_03101.t, (SELECT 1 AS a) AS db1_03101.t;
---- equivalent to:
2024-04-15 15:29:36 +00:00
--SELECT db2_03101.t.a, db1_03101.t.a FROM (SELECT 1 AS a) AS db2_03101.t, (SELECT 1 AS a) AS db1_03101.t;
CREATE TABLE t
(
x String,
nest Nested
(
a String,
b String
)
) ENGINE = Memory;
SELECT * FROM t;
-- equivalent to:
SELECT x, nest.* FROM t;
-- equivalent to:
SELECT x, nest.a, nest.b FROM t;