Skip to content

Commit

Permalink
Merge pull request #58138 from ClickHouse/backport/23.3/57906
Browse files Browse the repository at this point in the history
Backport #57906 to 23.3: Normalize function names in CREATE INDEX
  • Loading branch information
tavplubix committed Dec 22, 2023
2 parents 2f24011 + b32187d commit f217bdc
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Interpreters/InterpreterCreateFunctionQuery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <Functions/UserDefined/UserDefinedSQLFunctionFactory.h>
#include <Interpreters/Context.h>
#include <Interpreters/executeDDLQueryOnCluster.h>
#include <Interpreters/FunctionNameNormalizer.h>
#include <Parsers/ASTCreateFunctionQuery.h>


Expand All @@ -18,6 +19,8 @@ namespace ErrorCodes

BlockIO InterpreterCreateFunctionQuery::execute()
{
FunctionNameNormalizer().visit(query_ptr.get());

ASTCreateFunctionQuery & create_function_query = query_ptr->as<ASTCreateFunctionQuery &>();

AccessRightsElements access_rights_elements;
Expand Down
2 changes: 2 additions & 0 deletions src/Interpreters/InterpreterCreateIndexQuery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <Databases/DatabaseReplicated.h>
#include <Interpreters/Context.h>
#include <Interpreters/executeDDLQueryOnCluster.h>
#include <Interpreters/FunctionNameNormalizer.h>
#include <Parsers/ASTCreateIndexQuery.h>
#include <Parsers/ASTIdentifier.h>
#include <Parsers/ASTIndexDeclaration.h>
Expand All @@ -20,6 +21,7 @@ namespace ErrorCodes

BlockIO InterpreterCreateIndexQuery::execute()
{
FunctionNameNormalizer().visit(query_ptr.get());
auto current_context = getContext();
const auto & create_index = query_ptr->as<ASTCreateIndexQuery &>();

Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

create table rmt (n int, ts DateTime64(8, 'UTC')) engine=ReplicatedMergeTree('/test/02487/{database}/rmt', '1') order by n;
alter table rmt add index idx1 date(ts) TYPE MinMax GRANULARITY 1;
create index idx2 on rmt date(ts) TYPE MinMax GRANULARITY 1;
system restart replica rmt;
create table rmt2 (n int, ts DateTime64(8, 'UTC'), index idx1 date(ts) TYPE MinMax GRANULARITY 1, index idx2 date(ts) TYPE MinMax GRANULARITY 1) engine=ReplicatedMergeTree('/test/02487/{database}/rmt', '2') order by n;

0 comments on commit f217bdc

Please sign in to comment.