diff --git a/dbms/src/Parsers/ParserTablePropertiesQuery.cpp b/dbms/src/Parsers/ParserTablePropertiesQuery.cpp index e119ef5d07b..2ee85a3330d 100644 --- a/dbms/src/Parsers/ParserTablePropertiesQuery.cpp +++ b/dbms/src/Parsers/ParserTablePropertiesQuery.cpp @@ -41,6 +41,8 @@ bool ParserTablePropertiesQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & query = std::make_shared(); else if (s_dictionary.checkWithoutMoving(pos, expected)) query = std::make_shared(); + else + query = std::make_shared(); } else if (s_show.ignore(pos, expected)) { diff --git a/dbms/tests/queries/0_stateless/01048_exists_query.reference b/dbms/tests/queries/0_stateless/01048_exists_query.reference new file mode 100644 index 00000000000..aa6264c9a0a --- /dev/null +++ b/dbms/tests/queries/0_stateless/01048_exists_query.reference @@ -0,0 +1,24 @@ +0 +0 +0 +0 +0 +0 +1 +1 +0 +0 +0 +0 +0 +0 +0 +1 +1 +1 +0 +0 +0 +0 +0 +0 diff --git a/dbms/tests/queries/0_stateless/01048_exists_query.sql b/dbms/tests/queries/0_stateless/01048_exists_query.sql new file mode 100644 index 00000000000..a2e5a595ed2 --- /dev/null +++ b/dbms/tests/queries/0_stateless/01048_exists_query.sql @@ -0,0 +1,44 @@ +EXISTS database_for_dict.t; +EXISTS TABLE database_for_dict.t; +EXISTS DICTIONARY database_for_dict.t; + +DROP DATABASE IF EXISTS database_for_dict; +CREATE DATABASE database_for_dict Engine = Ordinary; + +DROP TABLE IF EXISTS database_for_dict.t; +EXISTS database_for_dict.t; +EXISTS TABLE database_for_dict.t; +EXISTS DICTIONARY database_for_dict.t; + +CREATE TABLE database_for_dict.t (x UInt8) ENGINE = Memory; +EXISTS database_for_dict.t; +EXISTS TABLE database_for_dict.t; +EXISTS DICTIONARY database_for_dict.t; + +DROP TABLE database_for_dict.t; +EXISTS database_for_dict.t; +EXISTS TABLE database_for_dict.t; +EXISTS DICTIONARY database_for_dict.t; + +DROP DICTIONARY IF EXISTS t; +CREATE TEMPORARY TABLE t (x UInt8); +EXISTS t; -- Does not work for temporary tables. Maybe have to fix. +EXISTS TABLE t; +EXISTS DICTIONARY t; + +CREATE DICTIONARY database_for_dict.t (k UInt64, v String) PRIMARY KEY k LAYOUT(FLAT()) SOURCE(HTTP(URL 'https://yandex.ru/' FORMAT TSV)) LIFETIME(1000); +EXISTS database_for_dict.t; +EXISTS TABLE database_for_dict.t; -- Dictionaries are tables as well. But not all tables are dictionaries. +EXISTS DICTIONARY database_for_dict.t; + +-- But dictionary-tables cannot be dropped as usual tables. +DROP TABLE database_for_dict.t; -- { serverError 60 } +DROP DICTIONARY database_for_dict.t; +EXISTS database_for_dict.t; +EXISTS TABLE database_for_dict.t; +EXISTS DICTIONARY database_for_dict.t; + +DROP DATABASE database_for_dict; +EXISTS database_for_dict.t; +EXISTS TABLE database_for_dict.t; +EXISTS DICTIONARY database_for_dict.t;