Bug fix explain ast with parameterized view

This commit is contained in:
Smita Kulkarni 2023-10-25 10:21:06 +02:00
parent da6f3346fe
commit efbcac4e60
3 changed files with 21 additions and 0 deletions

View File

@ -730,6 +730,12 @@ static std::tuple<ASTPtr, BlockIO> executeQueryImpl(
bool is_create_parameterized_view = false;
if (const auto * create_query = ast->as<ASTCreateQuery>())
is_create_parameterized_view = create_query->isParameterizedView();
else if (const auto * explain_query = ast->as<ASTExplainQuery>())
{
assert(explain_query->children.size() => 1);
if (const auto * create_of_explain_query = explain_query->children[0]->as<ASTCreateQuery>())
is_create_parameterized_view = create_of_explain_query->isParameterizedView();
}
/// Replace ASTQueryParameter with ASTLiteral for prepared statements.
/// Even if we don't have parameters in query_context, check that AST doesn't have unknown parameters

View File

@ -0,0 +1,12 @@
CreateQuery numbers_pv (children 2)
Identifier numbers_pv
SelectWithUnionQuery (children 1)
ExpressionList (children 1)
SelectQuery (children 3)
ExpressionList (children 1)
Asterisk
TablesInSelectQuery (children 1)
TablesInSelectQueryElement (children 1)
TableExpression (children 1)
TableIdentifier numbers
QueryParameter amount:UInt8

View File

@ -0,0 +1,3 @@
EXPLAIN AST
CREATE VIEW numbers_pv AS
SELECT * FROM numbers LIMIT {amount:UInt8};