mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-14 19:45:11 +00:00
Hide passwords in SHOW CREATE TABLE and system.tables.
This commit is contained in:
parent
8d72f75556
commit
d365570b27
@ -92,9 +92,7 @@ QueryPipeline InterpreterShowCreateQuery::executeImpl()
|
||||
create.to_inner_uuid = UUIDHelpers::Nil;
|
||||
}
|
||||
|
||||
WriteBufferFromOwnString buf;
|
||||
formatAST(*create_query, buf, false, false);
|
||||
String res = buf.str();
|
||||
String res = create_query->formatWithHiddenSecrets(/* max_length= */ 0, /* one_line= */ false, /* hilite= */ false);
|
||||
|
||||
MutableColumnPtr column = ColumnString::create();
|
||||
column->insert(res);
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include <Interpreters/Context.h>
|
||||
#include <Parsers/ASTCreateQuery.h>
|
||||
#include <Parsers/ASTSelectWithUnionQuery.h>
|
||||
#include <Parsers/queryToString.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/StringUtils/StringUtils.h>
|
||||
#include <DataTypes/DataTypesNumber.h>
|
||||
@ -232,7 +231,7 @@ protected:
|
||||
{
|
||||
auto temp_db = DatabaseCatalog::instance().getDatabaseForTemporaryTables();
|
||||
ASTPtr ast = temp_db ? temp_db->tryGetCreateTableQuery(table.second->getStorageID().getTableName(), context) : nullptr;
|
||||
res_columns[res_index++]->insert(ast ? queryToString(ast) : "");
|
||||
res_columns[res_index++]->insert(ast ? ast->formatWithHiddenSecrets() : "");
|
||||
}
|
||||
|
||||
// engine_full
|
||||
@ -383,7 +382,7 @@ protected:
|
||||
}
|
||||
|
||||
if (columns_mask[src_index++])
|
||||
res_columns[res_index++]->insert(ast ? queryToString(ast) : "");
|
||||
res_columns[res_index++]->insert(ast ? ast->formatWithHiddenSecrets() : "");
|
||||
|
||||
if (columns_mask[src_index++])
|
||||
{
|
||||
@ -391,7 +390,7 @@ protected:
|
||||
|
||||
if (ast_create && ast_create->storage)
|
||||
{
|
||||
engine_full = queryToString(*ast_create->storage);
|
||||
engine_full = ast_create->storage->formatWithHiddenSecrets();
|
||||
|
||||
static const char * const extra_head = " ENGINE = ";
|
||||
if (startsWith(engine_full, extra_head))
|
||||
@ -405,7 +404,7 @@ protected:
|
||||
{
|
||||
String as_select;
|
||||
if (ast_create && ast_create->select)
|
||||
as_select = queryToString(*ast_create->select);
|
||||
as_select = ast_create->select->formatWithHiddenSecrets();
|
||||
res_columns[res_index++]->insert(as_select);
|
||||
}
|
||||
}
|
||||
@ -420,7 +419,7 @@ protected:
|
||||
if (columns_mask[src_index++])
|
||||
{
|
||||
if (metadata_snapshot && (expression_ptr = metadata_snapshot->getPartitionKeyAST()))
|
||||
res_columns[res_index++]->insert(queryToString(expression_ptr));
|
||||
res_columns[res_index++]->insert(expression_ptr->formatWithHiddenSecrets());
|
||||
else
|
||||
res_columns[res_index++]->insertDefault();
|
||||
}
|
||||
@ -428,7 +427,7 @@ protected:
|
||||
if (columns_mask[src_index++])
|
||||
{
|
||||
if (metadata_snapshot && (expression_ptr = metadata_snapshot->getSortingKey().expression_list_ast))
|
||||
res_columns[res_index++]->insert(queryToString(expression_ptr));
|
||||
res_columns[res_index++]->insert(expression_ptr->formatWithHiddenSecrets());
|
||||
else
|
||||
res_columns[res_index++]->insertDefault();
|
||||
}
|
||||
@ -436,7 +435,7 @@ protected:
|
||||
if (columns_mask[src_index++])
|
||||
{
|
||||
if (metadata_snapshot && (expression_ptr = metadata_snapshot->getPrimaryKey().expression_list_ast))
|
||||
res_columns[res_index++]->insert(queryToString(expression_ptr));
|
||||
res_columns[res_index++]->insert(expression_ptr->formatWithHiddenSecrets());
|
||||
else
|
||||
res_columns[res_index++]->insertDefault();
|
||||
}
|
||||
@ -444,7 +443,7 @@ protected:
|
||||
if (columns_mask[src_index++])
|
||||
{
|
||||
if (metadata_snapshot && (expression_ptr = metadata_snapshot->getSamplingKeyAST()))
|
||||
res_columns[res_index++]->insert(queryToString(expression_ptr));
|
||||
res_columns[res_index++]->insert(expression_ptr->formatWithHiddenSecrets());
|
||||
else
|
||||
res_columns[res_index++]->insertDefault();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user