Skip to content

Commit 18e617a

Browse files
Do not merge until v8.5.4: MySQL compatibility about decimal insert through jdbc (#21046)
1 parent de3738d commit 18e617a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

develop/dev-guide-sample-application-java-jdbc.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,17 @@ Java 驱动程序提供对数据库的底层访问,但要求开发者:
280280
- 减少管理连接和事务的[模板代码](https://en.wikipedia.org/wiki/Boilerplate_code)
281281
- 使用数据对象代替大量 SQL 语句来操作数据
282282
283+
### MySQL 兼容性
284+
285+
在 MySQL 中,当写入 `DECIMAL` 类型的数据时,如果小数位数超过字段定义的小数位数,无论超出多少,都会自动截断多余的位数并成功插入。
286+
287+
在 TiDB v8.5.3 及之前版本中:
288+
289+
- 如果小数位数超过字段定义的小数位数但未超过 72 位,同样会自动截断多余的位数并成功插入。
290+
- 如果小数位数超过 72 位,写入会失败并报错。
291+
292+
从 TiDB v8.5.4 开始,TiDB 的行为和 MySQL 保持一致:无论小数位数超过多少,都会自动截断多余的位数并成功插入。
293+
283294
## 下一步
284295
285296
- 关于 MySQL Connector/J 的更多使用方法,可以参考 [MySQL Connector/J 官方文档](https://dev.mysql.com/doc/connector-j/en/)。

0 commit comments

Comments
 (0)