提交 576664f0 编写于 作者: O obdev 提交者: linzhigang.lzg

[CP] fix bugs of float data type in mysql mode

上级 cc0f8858
......@@ -4536,6 +4536,10 @@ int_type_i opt_int_length_i opt_unsigned_i opt_zerofill_i
}
| float_type_i opt_float_precision opt_unsigned_i opt_zerofill_i
{
if (T_FLOAT != $1[0] && NULL != $2 && -1 == $2->int16_values_[1]) {
yyerror(&@2, result, "double type not support double(M) syntax\n");
YYERROR;
}
malloc_terminal_node($$, result->malloc_pool_, ($3[0] || $4[0]) ? $1[0] + (T_UFLOAT - T_FLOAT) : $1[0]);
if (NULL != $2) {
$$->int16_values_[0] = $2->int16_values_[0];
......@@ -4759,6 +4763,14 @@ opt_float_precision:
$$->int16_values_[0] = $2->value_;
$$->int16_values_[1] = -1;
}
| '(' DECIMAL_VAL ')'
{
malloc_terminal_node($$, result->malloc_pool_, T_LINK_NODE);
int err_no = 0;
$2->value_ = ob_strntoll($2->str_value_, $2->str_len_, 10, NULL, &err_no);
$$->int16_values_[0] = $2->value_;
$$->int16_values_[1] = -1;
}
| /*EMPTY*/
{
$$ = NULL;
......
......@@ -3807,10 +3807,17 @@ int ObResolverUtils::resolve_data_type(const ParseNode& type_node, const ObStrin
ret = OB_ERR_TOO_BIG_SCALE;
LOG_USER_ERROR(OB_ERR_TOO_BIG_SCALE, scale, ident_name.ptr(), OB_MAX_DOUBLE_FLOAT_SCALE);
LOG_WARN("scale of double overflow", K(ret), K(scale), K(precision));
} else if (OB_UNLIKELY(precision > OB_MAX_DOUBLE_FLOAT_PRECISION)) {
} else if (OB_UNLIKELY(OB_DECIMAL_NOT_SPECIFIED == scale &&
precision > OB_MAX_DOUBLE_FLOAT_PRECISION)) {
ret = OB_ERR_COLUMN_SPEC;
LOG_USER_ERROR(OB_ERR_COLUMN_SPEC, ident_name.length(), ident_name.ptr());
LOG_WARN("precision of double overflow", K(ret), K(scale), K(precision));
} else if (OB_UNLIKELY(OB_DECIMAL_NOT_SPECIFIED != scale &&
precision > OB_MAX_DOUBLE_FLOAT_DISPLAY_WIDTH)) {
ret = OB_ERR_TOO_BIG_DISPLAYWIDTH;
LOG_USER_ERROR(OB_ERR_TOO_BIG_DISPLAYWIDTH,
ident_name.ptr(),
OB_MAX_INTEGER_DISPLAY_WIDTH);
} else if (OB_UNLIKELY(precision < scale)) {
ret = OB_ERR_M_BIGGER_THAN_D;
LOG_USER_ERROR(OB_ERR_M_BIGGER_THAN_D, to_cstring(ident_name));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册