提交 a6a6fc99 authored 作者: Thomas Mueller's avatar Thomas Mueller

When creating a table, the precision must now be at least as large as the scale.

上级 2fff842b
......@@ -3682,6 +3682,9 @@ public class Parser {
// MySQL compatibility
readIf("UNSIGNED");
int type = dataType.type;
if (scale > precision) {
throw DbException.get(ErrorCode.INVALID_VALUE_2, Integer.toString(scale), "scale (precision = " + precision + ")");
}
Column column = new Column(columnName, type, precision, scale, displaySize);
if (templateColumn != null) {
column.setNullable(templateColumn.isNullable());
......@@ -5194,7 +5197,6 @@ public class Parser {
*
* @param sql the code snippet
* @return the expression object
* @throws SQLException if the code snippet could not be parsed
*/
public Expression parseExpression(String sql) {
parameters = New.arrayList();
......
--- special grammar and test cases ---------------------------------------------------------------------------------------------
create table test(d decimal(1, 2));
> exception
call truncate_value('Test 123', 4, false);
> 'Test'
> ------
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论