Add string access operator []
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
MySQL Server |
Unknown
|
Unknown
|
||||
Percona Server moved to https://jira.percona.com/projects/PS | Status tracked in 5.7 | |||||
5.5 |
Won't Fix
|
Undecided
|
Unassigned | |||
5.6 |
Won't Fix
|
Undecided
|
Unassigned | |||
5.7 |
Triaged
|
Wishlist
|
Unassigned |
Bug Description
I propose to introduce a new operators [pos] and [pos:len] to access elements of string types. Where pos - element index, starting from 0, as in c++ stings. Example:
mysql> CREATE TABLE `test` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`data` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
mysql> INSERT INTO `test` (`id`,`data`) VALUES(0,'');
mysql> UPDATE `test` SET `data`[5] = 'xxx';
mysql> SELECT * FROM `test` WHERE `id`=0;
+-----+
| sid | data |
+-----+
| 0 | ' xxx'
+-----+
mysql> UPDATE `test` SET `data`[3] = 'aaa';
mysql> SELECT * FROM `test` WHERE `id`=0;
+-----+
| sid | data |
+-----+
| 0 | ' aaaxx'
+-----+
mysql> UPDATE `test` SET `data`[3:1] = 'bbbbbb';
mysql> SELECT * FROM `test` WHERE `id`=0;
+-----+
| sid | data |
+-----+
| 0 | ' baaxx'
+-----+
mysql> SELECT `data`[4:3] FROM `test` WHERE `id`=0;
+------
| data |
+------
| 'aax'
+------
Changed in percona-server: | |
status: | Incomplete → New |
tags: | added: upstream |
Hi,
Could you specify semantics in more details ? like for /dev.mysql. com/doc/ refman/ 5.6/en/ string- functions. html#function_ substring- index
https:/
After that, you should report this to upstream bug (Oracle MySQL). Because Percona server is based on Native MySQL.