more tests for joins

This commit is contained in:
chertus 2018-10-31 18:09:53 +03:00
parent 6393c24109
commit 6bbbd8721c
2 changed files with 37 additions and 0 deletions

View File

@ -1,6 +1,18 @@
┌─database─┬─name─┐
│ system │ one │
└──────────┴──────┘
┌─database─┬─name─┐
│ system │ one │
└──────────┴──────┘
┌─database─┬─name─┐
│ system │ one │
└──────────┴──────┘
┌─x──────┬─name─┐ ┌─x──────┬─name─┐
│ system │ one │ │ system │ one │
└────────┴──────┘ └────────┴──────┘
┌─database─┬─name─┐
│ system │ one │
└──────────┴──────┘
┌─x──────┬─name─┐ ┌─x──────┬─name─┐
│ system │ one │ │ system │ one │
└────────┴──────┘ └────────┴──────┘

View File

@ -2,12 +2,37 @@ CREATE DATABASE IF NOT EXISTS test;
DROP TABLE IF EXISTS test.one; DROP TABLE IF EXISTS test.one;
CREATE TABLE test.one(dummy UInt8) ENGINE = Memory; CREATE TABLE test.one(dummy UInt8) ENGINE = Memory;
SELECT database, t.name
FROM system.tables AS t
ALL INNER JOIN (SELECT name AS database FROM system.databases) AS db USING database
WHERE database = 'system' AND t.name = 'one'
FORMAT PrettyCompactNoEscapes;
SELECT database, t.name
FROM (SELECT name AS database FROM system.databases) AS db
ALL INNER JOIN system.tables AS t USING database
WHERE database = 'system' AND t.name = 'one'
FORMAT PrettyCompactNoEscapes;
SELECT database, t.name
FROM (SELECT name, database FROM system.tables) AS t
ALL INNER JOIN (SELECT name AS database FROM system.databases) AS db USING database
WHERE database = 'system' AND t.name = 'one'
FORMAT PrettyCompactNoEscapes;
SELECT x, t.name SELECT x, t.name
FROM (SELECT name, database AS x FROM system.tables) AS t FROM (SELECT name, database AS x FROM system.tables) AS t
ALL INNER JOIN (SELECT name AS x FROM system.databases) AS db USING x ALL INNER JOIN (SELECT name AS x FROM system.databases) AS db USING x
WHERE x = 'system' AND t.name = 'one' WHERE x = 'system' AND t.name = 'one'
FORMAT PrettyCompactNoEscapes; FORMAT PrettyCompactNoEscapes;
SELECT database, t.name
FROM (SELECT name, database FROM system.tables) AS t
JOIN (SELECT name AS database FROM system.databases) AS db USING database
WHERE database = 'system' AND t.name = 'one'
SETTINGS join_default_strictness = 'ALL'
FORMAT PrettyCompactNoEscapes;
SELECT x, t.name SELECT x, t.name
FROM (SELECT name, database AS x FROM system.tables) AS t FROM (SELECT name, database AS x FROM system.tables) AS t
JOIN (SELECT name AS x FROM system.databases) AS db USING x JOIN (SELECT name AS x FROM system.databases) AS db USING x