Merge pull request #36423 from CurtizJ/return-back-36126

Return back #36126
This commit is contained in:
Anton Popov 2022-04-22 14:27:57 +02:00 committed by GitHub
commit 5b5dd4fa46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 60 additions and 2 deletions

View File

@ -33,7 +33,12 @@ DataTypePtr DataTypeFactory::get(const String & full_name) const
/// Value 315 is known to cause stack overflow in some test configurations (debug build, sanitizers)
/// let's make the threshold significantly lower.
/// It is impractical for user to have complex data types with this depth.
static constexpr size_t data_type_max_parse_depth = 200;
#if defined(SANITIZER) || !defined(NDEBUG)
static constexpr size_t data_type_max_parse_depth = 150;
#else
static constexpr size_t data_type_max_parse_depth = 300;
#endif
ParserDataType parser;
ASTPtr ast = parseQuery(parser, full_name.data(), full_name.data() + full_name.size(), "data type", 0, data_type_max_parse_depth);

View File

@ -92,11 +92,25 @@ bool ParserDataType::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
}
else if (type_name_upper.find("INT") != std::string::npos)
{
/// Support SIGNED and UNSIGNED integer type modifiers for compatibility with MySQL.
/// Support SIGNED and UNSIGNED integer type modifiers for compatibility with MySQL
if (ParserKeyword("SIGNED").ignore(pos))
type_name_suffix = "SIGNED";
else if (ParserKeyword("UNSIGNED").ignore(pos))
type_name_suffix = "UNSIGNED";
else if (pos->type == TokenType::OpeningRoundBracket)
{
++pos;
if (pos->type == TokenType::Number)
++pos;
if (pos->type != TokenType::ClosingRoundBracket)
return false;
++pos;
if (ParserKeyword("SIGNED").ignore(pos))
type_name_suffix = "SIGNED";
else if (ParserKeyword("UNSIGNED").ignore(pos))
type_name_suffix = "UNSIGNED";
}
}
if (!type_name_suffix.empty())

View File

@ -0,0 +1,10 @@
CREATE TEMPORARY TABLE t1_02271\n(\n `x` Int32\n)\nENGINE = Memory
CREATE TEMPORARY TABLE t2_02271\n(\n `x` Int32 DEFAULT 1\n)\nENGINE = Memory
CREATE TEMPORARY TABLE t3_02271\n(\n `x` UInt32\n)\nENGINE = Memory
CREATE TEMPORARY TABLE t4_02271\n(\n `x` Int32\n)\nENGINE = Memory
CREATE TEMPORARY TABLE t5_02271\n(\n `x` Int32 DEFAULT 1\n)\nENGINE = Memory
CREATE TEMPORARY TABLE t6_02271\n(\n `x` Int32\n)\nENGINE = Memory
CREATE TEMPORARY TABLE t7_02271\n(\n `x` Int32 DEFAULT 1\n)\nENGINE = Memory
CREATE TEMPORARY TABLE t8_02271\n(\n `x` UInt32\n)\nENGINE = Memory
CREATE TEMPORARY TABLE t9_02271\n(\n `x` Int32\n)\nENGINE = Memory
CREATE TEMPORARY TABLE t10_02271\n(\n `x` Int32 DEFAULT 1\n)\nENGINE = Memory

View File

@ -0,0 +1,29 @@
CREATE TEMPORARY TABLE t1_02271 (x INT(11));
SHOW CREATE TEMPORARY TABLE t1_02271;
CREATE TEMPORARY TABLE t2_02271 (x INT(11) DEFAULT 1);
SHOW CREATE TEMPORARY TABLE t2_02271;
CREATE TEMPORARY TABLE t3_02271 (x INT(11) UNSIGNED);
SHOW CREATE TEMPORARY TABLE t3_02271;
CREATE TEMPORARY TABLE t4_02271 (x INT(11) SIGNED);
SHOW CREATE TEMPORARY TABLE t4_02271;
CREATE TEMPORARY TABLE t5_02271 (x INT(11) SIGNED DEFAULT 1);
SHOW CREATE TEMPORARY TABLE t5_02271;
CREATE TEMPORARY TABLE t6_02271 (x INT());
SHOW CREATE TEMPORARY TABLE t6_02271;
CREATE TEMPORARY TABLE t7_02271 (x INT() DEFAULT 1);
SHOW CREATE TEMPORARY TABLE t7_02271;
CREATE TEMPORARY TABLE t8_02271 (x INT() UNSIGNED);
SHOW CREATE TEMPORARY TABLE t8_02271;
CREATE TEMPORARY TABLE t9_02271 (x INT() SIGNED);
SHOW CREATE TEMPORARY TABLE t9_02271;
CREATE TEMPORARY TABLE t10_02271 (x INT() SIGNED DEFAULT 1);
SHOW CREATE TEMPORARY TABLE t10_02271;