[MDEV-31915] JSON SP variables do not validate values on assignment Created: 2023-08-14  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: Data types, JSON
Affects Version/s: 10.9, 10.10, 10.11, 11.0, 11.1, 11.2
Fix Version/s: 10.11, 11.0, 11.1, 11.2

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates

 Description   

This script correctly rejects an invalid value being inserted into a JSON column:

CREATE OR REPLACE TABLE t1 (a JSON);
INSERT INTO t1 VALUES ('Foobar');
ERROR 4025 (23000): CONSTRAINT `t1.a` failed for `test`.`t1`

Assigning the same invalid value to a JSON SP variable works without errors:

DELIMITER $$
CREATE OR REPLACE PROCEDURE p1()
BEGIN
  DECLARE v1 JSON;
  SET v1 = 'Foobar';
  SELECT v1;
END;
$$
DELIMITER ;
CALL p1();

+--------+
| v1     |
+--------+
| Foobar |
+--------+

The assignment should probably fail as well.


Generated at Thu Feb 08 10:27:25 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.