mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +00:00
Merge pull request #43910 from FArthur-cmd/add_full_modifier
Add support for SHOW FULL
This commit is contained in:
commit
53b1b0fdc9
@ -111,7 +111,15 @@ String InterpreterShowTablesQuery::getRewrittenQuery()
|
||||
DatabaseCatalog::instance().assertDatabaseExists(database);
|
||||
|
||||
WriteBufferFromOwnString rewritten_query;
|
||||
rewritten_query << "SELECT name FROM system.";
|
||||
|
||||
if (query.full)
|
||||
{
|
||||
rewritten_query << "SELECT name, engine FROM system.";
|
||||
}
|
||||
else
|
||||
{
|
||||
rewritten_query << "SELECT name FROM system.";
|
||||
}
|
||||
|
||||
if (query.dictionaries)
|
||||
rewritten_query << "dictionaries ";
|
||||
|
@ -22,6 +22,7 @@ public:
|
||||
bool changed{false};
|
||||
bool temporary{false};
|
||||
bool caches{false};
|
||||
bool full{false};
|
||||
|
||||
String cluster_str;
|
||||
String from;
|
||||
|
@ -18,6 +18,7 @@ namespace DB
|
||||
bool ParserShowTablesQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||
{
|
||||
ParserKeyword s_show("SHOW");
|
||||
ParserKeyword s_full("FULL");
|
||||
ParserKeyword s_temporary("TEMPORARY");
|
||||
ParserKeyword s_tables("TABLES");
|
||||
ParserKeyword s_databases("DATABASES");
|
||||
@ -46,6 +47,11 @@ bool ParserShowTablesQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expec
|
||||
if (!s_show.ignore(pos, expected))
|
||||
return false;
|
||||
|
||||
if (s_full.ignore(pos, expected))
|
||||
{
|
||||
query->full = true;
|
||||
}
|
||||
|
||||
if (s_databases.ignore(pos, expected))
|
||||
{
|
||||
query->databases = true;
|
||||
|
@ -14,7 +14,7 @@ namespace DB
|
||||
class ParserShowTablesQuery : public IParserBase
|
||||
{
|
||||
protected:
|
||||
const char * getName() const override { return "SHOW [TEMPORARY] TABLES|DATABASES|CLUSTERS|CLUSTER 'name' [[NOT] [I]LIKE 'str'] [LIMIT expr]"; }
|
||||
const char * getName() const override { return "SHOW [FULL] [TEMPORARY] TABLES|DATABASES|CLUSTERS|CLUSTER 'name' [[NOT] [I]LIKE 'str'] [LIMIT expr]"; }
|
||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||
};
|
||||
|
||||
|
2
tests/queries/0_stateless/02480_tets_show_full.reference
Normal file
2
tests/queries/0_stateless/02480_tets_show_full.reference
Normal file
@ -0,0 +1,2 @@
|
||||
test_02480_table MergeTree
|
||||
test_02480_view View
|
18
tests/queries/0_stateless/02480_tets_show_full.sh
Executable file
18
tests/queries/0_stateless/02480_tets_show_full.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
# shellcheck source=../shell_config.sh
|
||||
. "$CURDIR"/../shell_config.sh
|
||||
|
||||
|
||||
database=$($CLICKHOUSE_CLIENT -q 'SELECT currentDatabase()')
|
||||
|
||||
$CLICKHOUSE_CLIENT -nm -q "
|
||||
DROP TABLE IF EXISTS test_02480_table;
|
||||
DROP VIEW IF EXISTS test_02480_view;
|
||||
CREATE TABLE test_02480_table (id Int64) ENGINE=MergeTree ORDER BY id;
|
||||
CREATE VIEW test_02480_view AS SELECT * FROM test_02480_table;
|
||||
SHOW FULL TABLES FROM $database LIKE '%';
|
||||
DROP TABLE IF EXISTS test_02480_table;
|
||||
DROP VIEW IF EXISTS test_02480_view;
|
||||
"
|
Loading…
Reference in New Issue
Block a user