support show table

This commit is contained in:
flynn 2023-04-10 06:37:47 +00:00
parent 0503ed6fb8
commit f87782b6b5
4 changed files with 18 additions and 3 deletions

View File

@ -118,7 +118,7 @@ namespace ErrorCodes
extern const int NUMBER_OF_COLUMNS_DOESNT_MATCH;
}
/** Query analyzer implementation overview. Please check documentation in QueryAnalysisPass.h before.
/** Query analyzer implementation overview. Please check documentation in QueryAnalysisPass.h first.
* And additional documentation for each method, where special cases are described in detail.
*
* Each node in query must be resolved. For each query tree node resolved state is specific.
@ -159,7 +159,7 @@ namespace ErrorCodes
*
* TODO: This does not supported properly before, because matchers could not be resolved from aliases.
*
* Identifiers are resolved with following resules:
* Identifiers are resolved with following rules:
* Resolution starts with current scope.
* 1. Try to resolve identifier from expression scope arguments. Lambda expression arguments are greatest priority.
* 2. Try to resolve identifier from aliases.

View File

@ -61,8 +61,9 @@ bool ParserTablePropertiesQuery::parseImpl(Pos & pos, ASTPtr & node, Expected &
}
else if (s_show.ignore(pos, expected))
{
auto old_expected = expected;
if (!s_create.ignore(pos, expected))
return false;
expected = old_expected;
if (s_database.ignore(pos, expected))
{

View File

@ -0,0 +1,2 @@
CREATE TABLE default.t_2710_show_table\n(\n `n1` UInt32,\n `s` String\n)\nENGINE = MergeTree\nORDER BY n1\nSETTINGS index_granularity = 8192
CREATE DATABASE t_2710_db\nENGINE = Atomic

View File

@ -0,0 +1,12 @@
DROP TABLE IF EXISTS t_2710_show_table;
CREATE TABLE t_2710_show_table(n1 UInt32, s String) engine=MergeTree order by n1;
SHOW TABLE t_2710_show_table;
DROP TABLE t_2710_show_table;
DROP DATABASE IF EXISTS t_2710_db;
CREATE DATABASE t_2710_db engine=Atomic;
SHOW DATABASE t_2710_db;
DROP DATABASE t_2710_db;