Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small follow-up to #48017 #48292

Merged
merged 1 commit into from
Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/en/sql-reference/statements/show.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,9 @@ The optional keyword `FULL` causes the output to include the collation, comment
- key - `PRI` if the column is part of the primary key, `SOR` if the column is part of the sorting key, empty otherwise (String)
- default - Default expression of the column if it is of type `ALIAS`, `DEFAULT`, or `MATERIALIZED`, otherwise `NULL`. (Nullable(String))
- extra - Additional information, currently unused (String)
- collation - Collation of the column, always `NULL` because ClickHouse has no per-column collations, only if `FULL` keyword was specified (Nullable(String))
- comment - Comment on the column, only if `FULL` keyword was specified (String)
- privilege - The privilege you have on this column, currently not available, only if `FULL` keyword was specified (String)
- collation - (only if `FULL` keyword was specified) Collation of the column, always `NULL` because ClickHouse has no per-column collations (Nullable(String))
- comment - (only if `FULL` keyword was specified) Comment on the column (String)
- privilege - (only if `FULL` keyword was specified) The privilege you have on this column, currently not available (String)

**Examples**

Expand Down
9 changes: 4 additions & 5 deletions src/Parsers/ASTShowColumnsQuery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,14 @@ void ASTShowColumnsQuery::formatQueryImpl(const FormatSettings & settings, Forma
<< "COLUMNS"
<< (settings.hilite ? hilite_none : "");

if (from_database.empty())
settings.ostr << (settings.hilite ? hilite_keyword : "") << " FROM " << (settings.hilite ? hilite_none : "") << backQuoteIfNeed(from_table);
else
settings.ostr << (settings.hilite ? hilite_keyword : "") << " FROM " << (settings.hilite ? hilite_none : "") << backQuoteIfNeed(from_database) << "." << backQuoteIfNeed(from_table);
settings.ostr << (settings.hilite ? hilite_keyword : "") << " FROM " << (settings.hilite ? hilite_none : "") << backQuoteIfNeed(from_table);
if (!from_database.empty())
settings.ostr << (settings.hilite ? hilite_keyword : "") << " FROM " << (settings.hilite ? hilite_none : "") << backQuoteIfNeed(from_database);


if (!like.empty())
settings.ostr << (settings.hilite ? hilite_keyword : "")
<< (not_like ? " NOT " : "")
<< (not_like ? " NOT" : "")
<< (case_insensitive_like ? " ILIKE " : " LIKE")
<< (settings.hilite ? hilite_none : "")
<< DB::quote << like;
Expand Down
6 changes: 3 additions & 3 deletions src/Parsers/ParserShowColumnsQuery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace DB
bool ParserShowColumnsQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
{
ASTPtr like;
ASTPtr from_db;
ASTPtr from_database;
ASTPtr from_table;

auto query = std::make_shared<ASTShowColumnsQuery>();
Expand Down Expand Up @@ -43,10 +43,10 @@ bool ParserShowColumnsQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expe

if (!abbreviated_form)
if (ParserKeyword("FROM").ignore(pos, expected) || ParserKeyword("IN").ignore(pos, expected))
if (!ParserIdentifier().parse(pos, from_db, expected))
if (!ParserIdentifier().parse(pos, from_database, expected))
return false;

tryGetIdentifierNameInto(from_db, query->from_database);
tryGetIdentifierNameInto(from_database, query->from_database);

if (ParserKeyword("NOT").ignore(pos, expected))
query->not_like = true;
Expand Down