-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add note about SELECT CAST(MeN AS CHAR) incompatibility #7663
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
/cc @XuHuaiyu |
data-type-numeric.md
Outdated
@@ -163,6 +163,10 @@ DOUBLE PRECISION [(M,D)] [UNSIGNED] [ZEROFILL], REAL[(M,D)] [UNSIGNED] [ZEROFILL | |||
> | |||
> 与在 MySQL 中一样,`DOUBLE` 数据类型存储近似值。对于货币之类的精确值,建议使用 `DECIMAL` 类型。 | |||
|
|||
> **注意:** | |||
> | |||
> TiDB 和 MySQL 在 `SELECT CAST(MeN AS CHAR)`(或者等价的 `SELECT CONVERT(MeM, CHAR)`)的结果显示上存在不一致,其中 `MeN` 是用科学计数法表示的双精度浮点数。MySQL 在 `N` 属于 `[-15, 14]` 范围时显示完整数值,在该范围外显示科学计数法。而 TiDB 始终显示完整数值。例如,MySQL 对于 `SELECT CAST(3.1415e15 AS CHAR)` 显示结果为 `3.1415e15`,而 TiDB 的显示结果为 `3141500000000000`。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里无需提到 cast 和 convert
只需要单纯的举例 select MeN,就已经不一样了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我在 master 上试了一下,单纯 select MeN 是一致的,TiDB 也是 [-15, 14] 显示完整数值,否则科学计数法。
@xuyifangreeneyes 只适用于 master,不适用于 v5.3 吗? |
4.0, 5.0, 5.1, 5.2, 5.3 都有这个不一致的行为,所以都要 cherry-pick? |
如果只是补充说明优化文档,建议就改 master。 |
Removed the needs-cherry-pick-release-6.3 label because the v6.3 docs have been archived at https://docs-archive.pingcap.com/zh/tidb/v6.3 and will no longer receive new updates. |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: aa829a7
|
In response to a cherrypick label: new pull request created to branch |
In response to a cherrypick label: new pull request created to branch |
In response to a cherrypick label: new pull request created to branch |
What is changed, added or deleted? (Required)
Add note about the incompatibility result of
SELECT CAST(MeN AS CHAR)
between TiDB and MySQL.Which TiDB version(s) do your changes apply to? (Required)
Tips for choosing the affected version(s):
By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.
For details, see tips for choosing the affected versions (in Chinese).
What is the related PR or file link(s)?
Do your changes match any of the following descriptions?