ClickHouse/tests/queries/0_stateless/02337_analyzer_columns_basic.sql

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

102 lines
2.3 KiB
MySQL
Raw Normal View History

2022-09-10 20:06:41 +00:00
-- Tags: no-parallel
SET allow_experimental_analyzer = 1;
2022-07-14 11:31:58 +00:00
-- Empty from section
SELECT 'Empty from section';
DESCRIBE (SELECT dummy);
SELECT dummy;
SELECT '--';
DESCRIBE (SELECT one.dummy);
SELECT one.dummy;
SELECT '--';
DESCRIBE (SELECT system.one.dummy);
SELECT system.one.dummy;
DROP TABLE IF EXISTS test_table;
CREATE TABLE test_table
(
id UInt64,
value String
) ENGINE=TinyLog;
INSERT INTO test_table VALUES (0, 'Value');
SELECT 'Table access without table name qualification';
SELECT test_id FROM test_table; -- { serverError 47 }
2023-01-10 10:16:29 +00:00
SELECT test_id FROM test_unknown_table; -- { serverError 47 }
2022-07-14 11:31:58 +00:00
DESCRIBE (SELECT id FROM test_table);
SELECT id FROM test_table;
SELECT '--';
DESCRIBE (SELECT value FROM test_table);
SELECT value FROM test_table;
SELECT '--';
DESCRIBE (SELECT id, value FROM test_table);
SELECT id, value FROM test_table;
SELECT 'Table access with table name qualification';
DESCRIBE (SELECT test_table.id FROM test_table);
SELECT test_table.id FROM test_table;
SELECT '--';
DESCRIBE (SELECT test_table.value FROM test_table);
SELECT test_table.value FROM test_table;
SELECT '--';
DESCRIBE (SELECT test_table.id, test_table.value FROM test_table);
SELECT test_table.id, test_table.value FROM test_table;
SELECT '--';
DESCRIBE (SELECT test.id, test.value FROM test_table AS test);
SELECT test.id, test.value FROM test_table AS test;
DROP TABLE test_table;
SELECT 'Table access with database and table name qualification';
DROP DATABASE IF EXISTS 02337_db;
CREATE DATABASE 02337_db;
DROP TABLE IF EXISTS 02337_db.test_table;
CREATE TABLE 02337_db.test_table
(
id UInt64,
value String
) ENGINE=TinyLog;
INSERT INTO 02337_db.test_table VALUES (0, 'Value');
SELECT '--';
DESCRIBE (SELECT test_table.id, test_table.value FROM 02337_db.test_table);
SELECT test_table.id, test_table.value FROM 02337_db.test_table;
SELECT '--';
DESCRIBE (SELECT 02337_db.test_table.id, 02337_db.test_table.value FROM 02337_db.test_table);
SELECT 02337_db.test_table.id, 02337_db.test_table.value FROM 02337_db.test_table;
SELECT '--';
DESCRIBE (SELECT test_table.id, test_table.value FROM 02337_db.test_table AS test_table);
SELECT test_table.id, test_table.value FROM 02337_db.test_table AS test_table;
DROP TABLE 02337_db.test_table;
DROP DATABASE 02337_db;