-
Notifications
You must be signed in to change notification settings - Fork 688
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
Enrich instructions for string functions INSTR() and LCASE() #16144
Conversation
Welcome @jyf111! |
fix url Co-authored-by: Daniël van Eeden <[email protected]>
Co-authored-by: Daniël van Eeden <[email protected]>
fix url
add a case insensitive example for INSTR()
polish sentence
@jyf111 there are a few issues reported by the verify ci job:
|
fix manual line breaks
fix manual line breaks
/test pull-verify |
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.
Other LGTM
``` | ||
|
||
```sql | ||
SELECT INSTR("pingcap.com/tidb", "TiDB"); |
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.
Which tidb version do you use? I tried it on my tidb cluster with tidb commit cac449b3370c5, and get different result.
mysql> SELECT INSTR("pingcap.com/tidb", "TiDB");
+-----------------------------------+
| INSTR("pingcap.com/tidb", "TiDB") |
+-----------------------------------+
| 13 |
+-----------------------------------+
and we can get 0 with this sql
mysql> SELECT INSTR(_utf8mb4 "pingcap.com/tidb", _utf8mb4 "TiDB");
+-----------------------------------------------------+
| INSTR(_utf8mb4 "pingcap.com/tidb", _utf8mb4 "TiDB") |
+-----------------------------------------------------+
| 0 |
+-----------------------------------------------------+
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.
mysql> SELECT TIDB_VERSION()\G
*************************** 1. row ***************************
TIDB_VERSION(): Release Version: v7.1.1-serverless
Edition: Community
Git Commit Hash: 14db49a2968b68ac4cf3e4a59db87ba30a97996d
Git Branch: release-7.1-serverless
UTC Build Time: 2024-01-29 10:05:53
GoVersion: go1.21.6
Race Enabled: false
TiKV Min Version: 6.1.0
Check Table Before Drop: false
Store: tikv
1 row in set (0.24 sec)
mysql> SHOW VARIABLES LIKE 'collation\_%';
+----------------------+-------------+
| Variable_name | Value |
+----------------------+-------------+
| collation_connection | utf8mb4_bin |
| collation_database | utf8mb4_bin |
| collation_server | utf8mb4_bin |
+----------------------+-------------+
3 rows in set (0.25 sec)
mysql> SELECT INSTR("pingcap.com/tidb", "TiDB");
+-----------------------------------+
| INSTR("pingcap.com/tidb", "TiDB") |
+-----------------------------------+
| 0 |
+-----------------------------------+
1 row in set (0.24 sec)
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.
@jyf111, thanks for sharing the version info. Currently, the "master" branch of TiDB docs is for TiDB v7.6.0. Would you please try installing TiDB v7.6 according to this quick start guide? Thanks.
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.
mysql> SELECT TIDB_VERSION()\G
*************************** 1. row ***************************
TIDB_VERSION(): Release Version: v7.6.0
Edition: Community
Git Commit Hash: 52794d985ba6325d75a714d4eaa0838d59425eb6
Git Branch: heads/refs/tags/v7.6.0
UTC Build Time: 2024-01-22 14:20:42
GoVersion: go1.21.5
Race Enabled: false
Check Table Before Drop: false
Store: tikv
1 row in set (0.01 sec)
mysql> SHOW VARIABLES LIKE 'collation\_%';
+----------------------+--------------------+
| Variable_name | Value |
+----------------------+--------------------+
| collation_connection | utf8mb4_0900_ai_ci |
| collation_database | utf8mb4_bin |
| collation_server | utf8mb4_bin |
+----------------------+--------------------+
3 rows in set (0.01 sec)
mysql> SELECT INSTR("pingcap.com/tidb", "TiDB");
+-----------------------------------+
| INSTR("pingcap.com/tidb", "TiDB") |
+-----------------------------------+
| 13 |
+-----------------------------------+
1 row in set (0.00 sec)
Um.. But I don't know why collation_connection
becomes utf8mb4_0900_ai_ci
.
The latest doc still shows that the default value of collation_connection
is utf8mb4_bin
.
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.
Hi @jyf111, thanks for checking the version.
According to @YangKeao (a TiDB developer), utf8mb4_0900_ai_ci
was introduced in v7.4 to be compatible with MySQL 8.0 (pingcap/tidb#45650).
Starting from v7.4.0, the default collation of utf8mb4
on TiDB depends on the version of MySQL client, and @YangKeao will create a PR to clarify this issue in the doc.
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.
@jyf111 FYI, here is the docPR created by @YangKeao: https://github.com/pingcap/docs/pull/16423/files
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.
Great. I have updated the sentences related to case sensitivity and collations. PTAL
@xzhangxian1008: adding LGTM is restricted to approvers and reviewers in OWNERS files. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/retest |
/retest |
/retest |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: qiancai The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
First-time contributors' checklist
What is changed, added or deleted? (Required)
Fix #15489.
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.
What is the related PR or file link(s)?
Do your changes match any of the following descriptions?