From 4e668a5b06974afe45e7c6cbdb74e5c98297fae1 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov Date: Mon, 30 Mar 2020 23:41:29 +0300 Subject: [PATCH] fixup --- dbms/src/Interpreters/ActionsVisitor.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dbms/src/Interpreters/ActionsVisitor.cpp b/dbms/src/Interpreters/ActionsVisitor.cpp index b2091465be9..fd36cd27a0e 100644 --- a/dbms/src/Interpreters/ActionsVisitor.cpp +++ b/dbms/src/Interpreters/ActionsVisitor.cpp @@ -199,12 +199,15 @@ static String getUniqueName(const Block & block, const String & prefix) { auto result = prefix; - if (block.has(prefix)) + if (block.has(result)) { int i = 1; - while (block.has(prefix + toString(i))) + do + { + result = prefix + "_" + toString(i); ++i; - result = prefix + "_" + toString(i); + } + while (block.has(result)); } return result;