Skip to content
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

Merged
merged 7 commits into from
May 15, 2023

Conversation

xuyifangreeneyes
Copy link
Contributor

@xuyifangreeneyes xuyifangreeneyes commented Nov 24, 2021

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).

  • master (the latest development version)
  • v5.3 (TiDB 5.3 versions)
  • v5.2 (TiDB 5.2 versions)
  • v5.1 (TiDB 5.1 versions)
  • v5.0 (TiDB 5.0 versions)
  • v4.0 (TiDB 4.0 versions)
  • v3.1 (TiDB 3.1 versions)
  • v3.0 (TiDB 3.0 versions)
  • v2.1 (TiDB 2.1 versions)

What is the related PR or file link(s)?

  • This PR is translated from:
  • Other reference link(s):

Do your changes match any of the following descriptions?

  • Delete files
  • Change aliases
  • Need modification after applied to another branch
  • Might cause conflicts after applied to another branch

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Nov 24, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • lilin90
  • qiancai

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added missing-translation-status This PR does not have translation status info. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Nov 24, 2021
@xuyifangreeneyes
Copy link
Contributor Author

/cc @XuHuaiyu

@@ -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`。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里无需提到 cast 和 convert
只需要单纯的举例 select MeN,就已经不一样了

Copy link
Contributor Author

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] 显示完整数值,否则科学计数法。

@TomShawn TomShawn self-assigned this Nov 24, 2021
@TomShawn TomShawn added area/sql-infra Indicates that the Issue or PR belongs to the area of sql-infra and sql-metadata. translation/doing This PR’s assignee is translating this PR. type/enhancement The issue or PR belongs to an enhancement. and removed missing-translation-status This PR does not have translation status info. labels Nov 24, 2021
@TomShawn
Copy link
Contributor

@xuyifangreeneyes 只适用于 master,不适用于 v5.3 吗?

@xuyifangreeneyes
Copy link
Contributor Author

@xuyifangreeneyes 只适用于 master,不适用于 v5.3 吗?

4.0, 5.0, 5.1, 5.2, 5.3 都有这个不一致的行为,所以都要 cherry-pick?

@TomShawn
Copy link
Contributor

TomShawn commented Dec 2, 2021

@xuyifangreeneyes 只适用于 master,不适用于 v5.3 吗?

4.0, 5.0, 5.1, 5.2, 5.3 都有这个不一致的行为,所以都要 cherry-pick?

如果只是补充说明优化文档,建议就改 master。

data-type-numeric.md Outdated Show resolved Hide resolved
functions-and-operators/cast-functions-and-operators.md Outdated Show resolved Hide resolved
data-type-numeric.md Outdated Show resolved Hide resolved
@qiancai
Copy link
Collaborator

qiancai commented Apr 6, 2023

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.

@ti-chi-bot ti-chi-bot bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels May 10, 2023
@qiancai qiancai added translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR. and removed translation/doing This PR’s assignee is translating this PR. status/PTAL This PR is ready for reviewing. labels May 10, 2023
@qiancai
Copy link
Collaborator

qiancai commented May 15, 2023

/merge

@ti-chi-bot
Copy link

ti-chi-bot bot commented May 15, 2023

This pull request has been accepted and is ready to merge.

Commit hash: aa829a7

@ti-chi-bot ti-chi-bot bot added the status/can-merge Indicates a PR has been approved by a committer. label May 15, 2023
@ti-chi-bot ti-chi-bot bot merged commit 5a5f6f0 into pingcap:master May 15, 2023
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.5: #13964.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.6: #13965.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.0: #13966.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/sql-infra Indicates that the Issue or PR belongs to the area of sql-infra and sql-metadata. needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR. type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants