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

JSON_EXTRACT as select conditions triggers syntax errors on Spider

    XMLWordPrintable

Details

    Description

      How to repeat:

      On Spider:

      spd.sql

      mysql> SHOW CREATE TABLE t1\G
      *************************** 1. row ***************************
             Table: t1
      Create Table: CREATE TABLE `t1` (
        `i` int(11) NOT NULL,
        `jdoc` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
        PRIMARY KEY (`i`)
      ) ENGINE=SPIDER DEFAULT CHARSET=latin1
       PARTITION BY LIST (`i` MOD 4)
      (PARTITION `pt0` VALUES IN (0) COMMENT = 'database "yxtest", table "t1", server "SPT0"' ENGINE = SPIDER,
       PARTITION `pt1` VALUES IN (1) COMMENT = 'database "yxtest", table "t1", server "SPT1"' ENGINE = SPIDER,
       PARTITION `pt2` VALUES IN (2) COMMENT = 'database "yxtest", table "t1", server "SPT2"' ENGINE = SPIDER,
       PARTITION `pt3` VALUES IN (3) COMMENT = 'database "yxtest", table "t1", server "SPT3"' ENGINE = SPIDER)
      1 row in set (0.00 sec)
       
      mysql> INSERT INTO t1 VALUES(1, '{"Name":"Tom", "Age":18}'), (2, '{"Name":"Jerry", "Age":20}');
      Query OK, 2 rows affected (0.00 sec)
      Records: 2  Duplicates: 0  Warnings: 0
       
      mysql> SELECT * FROM t1 WHERE json_extract(jdoc, '$.Age')=20;
      ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'json_extract '$.Age') = 20)' at line 1
      

      Suggest fix:

      https://github.com/MariaDB/server/pull/1732

      Attachments

        Activity

          People

            nayuta-yanagisawa Nayuta Yanagisawa (Inactive)
            yongxinxu Yongxin Xu
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

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