[MDEV-11146] SP variables of the SET data type erroneously allow values with comma Created: 2016-10-26  Updated: 2017-11-15  Resolved: 2016-11-15

Status: Closed
Project: MariaDB Server
Component/s: Parser, Stored routines
Affects Version/s: 5.5, 10.0, 10.1, 10.2, 10.3
Fix Version/s: 10.3.0

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: datatype

Issue Links:
Duplicate
is duplicated by MDEV-11155 Bad error message when creating a SET... Closed
Relates
relates to MDEV-11155 Bad error message when creating a SET... Closed

 Description   

Comma is not allowed in SET values in a field definition:

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a SET('a','b','c','a,b'));

ERROR 1367 (22007): Illegal set 'a,b' value found during parsing

SP variables erroneously allow commas:

DROP PROCEDURE IF EXISTS p1;
DELIMITER $$
CREATE PROCEDURE p1()
BEGIN
  DECLARE a SET('a','b','c','a,b');
  SET a='a,b';
  SELECT a, a+0;
END;
$$
DELIMITER ;
CALL p1();

Notice, the 'a,b' value is ignored.
Inserting assigning 'a,b' to the variable a results in the numeric value 3, which is a bit combination of 1 for 'a' and 2 for 'b'.

Commas should be disallowed in values for SP SET variables.


Generated at Thu Feb 08 07:47:39 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.