Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-31915

JSON SP variables do not validate values on assignment

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.11, 11.1(EOL), 11.2, 10.9(EOL), 10.10(EOL), 11.0(EOL)
    • 10.11, 11.2
    • Data types, JSON
    • None

    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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            bar Alexander Barkov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.