Update InterpreterShowCreateQuery.cpp

This commit is contained in:
alexey-milovidov 2018-03-07 22:39:05 +03:00 committed by GitHub
parent 2bb80baae5
commit eecdbe9c7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,16 +41,16 @@ BlockInputStreamPtr InterpreterShowCreateQuery::executeImpl()
const ASTShowCreateQuery & ast = typeid_cast<const ASTShowCreateQuery &>(*query_ptr);
if (ast.temporary && !ast.database.empty())
throw Exception("Can't add database When using `TEMPORARY`", ErrorCodes::SYNTAX_ERROR);
throw Exception("Temporary databases are not possible.", ErrorCodes::SYNTAX_ERROR);
ASTPtr createQuery = (ast.temporary ? context.getCreateExternalQuery(ast.table) :
ASTPtr create_query = (ast.temporary ? context.getCreateExternalQuery(ast.table) :
context.getCreateQuery(ast.database, ast.table));
if (!createQuery && ast.temporary)
throw Exception("Unable to show the create query of " + ast.table + ", It maybe created by system.");
if (!create_query && ast.temporary)
throw Exception("Unable to show the create query of " + ast.table + ". Maybe it is created by the system.");
std::stringstream stream;
formatAST(*createQuery, stream, false, true);
formatAST(*create_query, stream, false, true);
String res = stream.str();
MutableColumnPtr column = ColumnString::create();