mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 17:41:59 +00:00
fix parsing of ints
This commit is contained in:
parent
56bdc654d4
commit
7b7939c52c
@ -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)
|
/// Value 315 is known to cause stack overflow in some test configurations (debug build, sanitizers)
|
||||||
/// let's make the threshold significantly lower.
|
/// let's make the threshold significantly lower.
|
||||||
/// It is impractical for user to have complex data types with this depth.
|
/// 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;
|
ParserDataType parser;
|
||||||
ASTPtr ast = parseQuery(parser, full_name.data(), full_name.data() + full_name.size(), "data type", 0, data_type_max_parse_depth);
|
ASTPtr ast = parseQuery(parser, full_name.data(), full_name.data() + full_name.size(), "data type", 0, data_type_max_parse_depth);
|
||||||
|
@ -100,9 +100,8 @@ bool ParserDataType::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
|||||||
else if (pos->type == TokenType::OpeningRoundBracket)
|
else if (pos->type == TokenType::OpeningRoundBracket)
|
||||||
{
|
{
|
||||||
++pos;
|
++pos;
|
||||||
if (pos->type != TokenType::Number)
|
if (pos->type == TokenType::Number)
|
||||||
return false;
|
++pos;
|
||||||
++pos;
|
|
||||||
if (pos->type != TokenType::ClosingRoundBracket)
|
if (pos->type != TokenType::ClosingRoundBracket)
|
||||||
return false;
|
return false;
|
||||||
++pos;
|
++pos;
|
||||||
|
@ -1,5 +1 @@
|
|||||||
1
|
1
|
||||||
CREATE TEMPORARY TABLE t3_00841\n(\n `x` UInt32\n)\nENGINE = Memory
|
|
||||||
1
|
|
||||||
CREATE TEMPORARY TABLE t4_00841\n(\n `x` Int32\n)\nENGINE = Memory
|
|
||||||
1
|
|
||||||
|
@ -3,13 +3,3 @@ INSERT INTO t1_00841 VALUES (1);
|
|||||||
SELECT * FROM t1_00841;
|
SELECT * FROM t1_00841;
|
||||||
|
|
||||||
CREATE TEMPORARY TABLE test.t2_00841 (x UInt8); -- { serverError 442 }
|
CREATE TEMPORARY TABLE test.t2_00841 (x UInt8); -- { serverError 442 }
|
||||||
|
|
||||||
CREATE TEMPORARY TABLE t3_00841 (x INT(11) UNSIGNED);
|
|
||||||
SHOW CREATE TEMPORARY TABLE t3_00841;
|
|
||||||
INSERT INTO t3_00841 VALUES (1);
|
|
||||||
SELECT * FROM t3_00841;
|
|
||||||
|
|
||||||
CREATE TEMPORARY TABLE t4_00841 (x INT(11) SIGNED);
|
|
||||||
SHOW CREATE TEMPORARY TABLE t4_00841;
|
|
||||||
INSERT INTO t4_00841 VALUES (1);
|
|
||||||
SELECT * FROM t4_00841;
|
|
||||||
|
@ -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
|
29
tests/queries/0_stateless/02271_int_sql_compatibility.sql
Normal file
29
tests/queries/0_stateless/02271_int_sql_compatibility.sql
Normal 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;
|
Loading…
Reference in New Issue
Block a user