Bug #101721 | Creating a table which function instr is a field property | ||
---|---|---|---|
Submitted: | 23 Nov 2020 14:05 | Modified: | 23 Nov 2020 16:43 |
Reporter: | yi qian | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: DDL | Severity: | S3 (Non-critical) |
Version: | OS: | Any | |
Assigned to: | CPU Architecture: | Any |
[23 Nov 2020 14:05]
yi qian
[23 Nov 2020 15:17]
Frederic Descamps
Hello, instr(a,b) is the same as locate(b,a). So this is not a bug ;) And just a note: you should not use MyISAM storage engine if your data is important. I recommend you to use InnoDB. Cheers, lefred
[23 Nov 2020 16:37]
MySQL Verification Team
same thing for POSITION: mysql> drop table if exists t1; create table t1 (a varchar(10), b varchar(10), c int generated always as (position(a in b)) virtual) charset latin1; Query OK, 0 rows affected (0.01 sec) Query OK, 0 rows affected (0.04 sec) mysql> show create table t1\G *************************** 1. row *************************** Table: t1 Create Table: CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` int GENERATED ALWAYS AS (locate(`a`,`b`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 1 row in set (0.00 sec) https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_position "POSITION(substr IN str) is a synonym for LOCATE(substr,str). "
[23 Nov 2020 16:42]
MySQL Verification Team
same for MID/SUBSTR: mysql> drop table if exists t1; create table t1 (a varchar(10), b varchar(10), c int generated always as (mid(a,b,1)) virtual) charset latin1; Query OK, 0 rows affected, 1 warning (0.00 sec) Query OK, 0 rows affected (0.04 sec) mysql> show create table t1\G *************************** 1. row *************************** Table: t1 Create Table: CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` int GENERATED ALWAYS AS (substr(`a`,`b`,1)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 there's many synonyms that are equivalent (LCASE/LOWER + UCASE/UPPER, etc). So as lefred said it's not a bug.