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

JSON paths containing dashes are reported as syntax errors in procedures

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • 10.9.1
    • 10.9.5
    • JSON
    • EndeavorOS but with MariaDB 10.9.2 from Dockerhub container

    Description

      JSON paths with dashes in them are reported as syntax errors inside procedures. If they are free-standing, they work fine.

      DROP PROCEDURE IF EXISTS my_proc;
       
      DELIMITER $$
      CREATE PROCEDURE my_proc()
      BEGIN
      DECLARE result TEXT;
      SET result = JSON_EXTRACT('{ "my-key": 1 }', '$."my-key"');
      END $$
      DELIMITER ;
       
      CALL my_proc();
      

      --------------
      CALL my_proc()
      --------------
       
      ERROR 4042 (HY000) at line 11: Syntax error in JSON path in argument 2 to function 'json_extract' at position 6
      

      This syntax works in procedures on MariaDB 10.8.4 and prior.

      More about the environment:

      $ cat /etc/os-release
      NAME='EndeavourOS'
      PRETTY_NAME='EndeavourOS'
      ID=endeavouros
      ID_LIKE=arch
      BUILD_ID=2021.04.17
      ANSI_COLOR="38;2;23;147;209"
      HOME_URL='https://endeavouros.com'
      DOCUMENTATION_URL='https://discovery.endeavouros.com'
      SUPPORT_URL='https://forum.endeavouros.com'
      BUG_REPORT_URL='https://forum.endeavouros.com/c/arch-based-related-questions/bug-reports'
      LOGO=endeavouros
      

      Dockerized MariaDB:

      Server version: 10.9.2-MariaDB-1:10.9.2+maria~ubu2204 mariadb.org binary distribution
      

      $ mysql --version
      mysql  Ver 15.1 Distrib 10.8.4-MariaDB, for Linux (x86_64) using readline 5.1
      

      But also tested with the client included in the docker container, same result:

      $ docker exec -it 97795998875c bin/mysql --version
      bin/mysql  Ver 15.1 Distrib 10.9.2-MariaDB, for debian-linux-gnu (x86_64) using  EditLine wrapper
      

      Attachments

        Issue Links

          Activity

            andrei-pavel Andrei Pavel created issue -
            andrei-pavel Andrei Pavel made changes -
            Field Original Value New Value
            Description JSON paths with dashes in them are reported as syntax errors.

            ```sql
            DROP PROCEDURE IF EXISTS my_proc;

            DELIMITER $$
            CREATE PROCEDURE my_proc()
            BEGIN
            DECLARE result TEXT;
            SET result = JSON_EXTRACT('{ "my-key": 1 }', '$."my-key"');
            END $$
            DELIMITER ;

            CALL my_proc();
            ```
            ```sql
            --------------
            CALL my_proc()
            --------------

            ERROR 4042 (HY000) at line 11: Syntax error in JSON path in argument 2 to function 'json_extract' at position 6
            ```

            This syntax works on MariaDB 10.9 (as tagged in dockerhub) and prior.
            JSON paths with dashes in them are reported as syntax errors inside procedures. If they are free-standing, they work fine.

            {code:sql}
            DROP PROCEDURE IF EXISTS my_proc;

            DELIMITER $$
            CREATE PROCEDURE my_proc()
            BEGIN
            DECLARE result TEXT;
            SET result = JSON_EXTRACT('{ "my-key": 1 }', '$."my-key"');
            END $$
            DELIMITER ;

            CALL my_proc();
            {code}

            {code:sql}
            --------------
            CALL my_proc()
            --------------

            ERROR 4042 (HY000) at line 11: Syntax error in JSON path in argument 2 to function 'json_extract' at position 6
            {code}

            This syntax works in procedures on MariaDB 10.9 (as tagged in dockerhub) and prior.

            More about the environment:
            {code:sh}
            $ cat /etc/os-release
            ───────┬───────────────────────────────────────────────────────────────────────────────────────
            │ File: /etc/os-release
            ───────┼───────────────────────────────────────────────────────────────────────────────────────
            1 │ NAME='EndeavourOS'
            2 │ PRETTY_NAME='EndeavourOS'
            3 │ ID=endeavouros
            4 │ ID_LIKE=arch
            5 │ BUILD_ID=2021.04.17
            6 │ ANSI_COLOR="38;2;23;147;209"
            7 │ HOME_URL='https://endeavouros.com'
            8 │ DOCUMENTATION_URL='https://discovery.endeavouros.com'
            9 │ SUPPORT_URL='https://forum.endeavouros.com'
            10 │ BUG_REPORT_URL='https://forum.endeavouros.com/c/arch-based-related-questions/bug-repo>
            11 │ LOGO=endeavouros
            ───────┴─────────────────────────────────
            {code}

            Dockerized MariaDB:
            {code:sh}
            Server version: 10.9.2-MariaDB-1:10.9.2+maria~ubu2204 mariadb.org binary distribution
            {code}

            {code:sh}
            $ mysql --version
            mysql Ver 15.1 Distrib 10.8.4-MariaDB, for Linux (x86_64) using readline 5.1
            {code}

            But also tested with the client included in the docker container, same result:
            {code:sh}
            $ docker exec -it 97795998875c bin/mysql --version
            bin/mysql Ver 15.1 Distrib 10.9.2-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper
            {code}
            Environment ```sh
            $ cat /etc/os-release
            ───────┬───────────────────────────────────────────────────────────────────────────────────────
            │ File: /etc/os-release
            ───────┼───────────────────────────────────────────────────────────────────────────────────────
            1 │ NAME='EndeavourOS'
            2 │ PRETTY_NAME='EndeavourOS'
            3 │ ID=endeavouros
            4 │ ID_LIKE=arch
            5 │ BUILD_ID=2021.04.17
            6 │ ANSI_COLOR="38;2;23;147;209"
            7 │ HOME_URL='https://endeavouros.com'
            8 │ DOCUMENTATION_URL='https://discovery.endeavouros.com'
            9 │ SUPPORT_URL='https://forum.endeavouros.com'
            10 │ BUG_REPORT_URL='https://forum.endeavouros.com/c/arch-based-related-questions/bug-repo>
            11 │ LOGO=endeavouros
            ───────┴─────────────────────────────────
            ```

            Dockerized MariaDB:
            ```sh
            Server version: 10.9.2-MariaDB-1:10.9.2+maria~ubu2204 mariadb.org binary distribution
            ```

            ```sh
            $ mysql --version
            mysql Ver 15.1 Distrib 10.8.4-MariaDB, for Linux (x86_64) using readline 5.1
            ```

            But also tested with the client included in the docker container, same result:
            ```sh
            $ docker exec -it 97795998875c bin/mysql --version
            bin/mysql Ver 15.1 Distrib 10.9.2-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper
            ```
            andrei-pavel Andrei Pavel made changes -
            Description JSON paths with dashes in them are reported as syntax errors inside procedures. If they are free-standing, they work fine.

            {code:sql}
            DROP PROCEDURE IF EXISTS my_proc;

            DELIMITER $$
            CREATE PROCEDURE my_proc()
            BEGIN
            DECLARE result TEXT;
            SET result = JSON_EXTRACT('{ "my-key": 1 }', '$."my-key"');
            END $$
            DELIMITER ;

            CALL my_proc();
            {code}

            {code:sql}
            --------------
            CALL my_proc()
            --------------

            ERROR 4042 (HY000) at line 11: Syntax error in JSON path in argument 2 to function 'json_extract' at position 6
            {code}

            This syntax works in procedures on MariaDB 10.9 (as tagged in dockerhub) and prior.

            More about the environment:
            {code:sh}
            $ cat /etc/os-release
            ───────┬───────────────────────────────────────────────────────────────────────────────────────
            │ File: /etc/os-release
            ───────┼───────────────────────────────────────────────────────────────────────────────────────
            1 │ NAME='EndeavourOS'
            2 │ PRETTY_NAME='EndeavourOS'
            3 │ ID=endeavouros
            4 │ ID_LIKE=arch
            5 │ BUILD_ID=2021.04.17
            6 │ ANSI_COLOR="38;2;23;147;209"
            7 │ HOME_URL='https://endeavouros.com'
            8 │ DOCUMENTATION_URL='https://discovery.endeavouros.com'
            9 │ SUPPORT_URL='https://forum.endeavouros.com'
            10 │ BUG_REPORT_URL='https://forum.endeavouros.com/c/arch-based-related-questions/bug-repo>
            11 │ LOGO=endeavouros
            ───────┴─────────────────────────────────
            {code}

            Dockerized MariaDB:
            {code:sh}
            Server version: 10.9.2-MariaDB-1:10.9.2+maria~ubu2204 mariadb.org binary distribution
            {code}

            {code:sh}
            $ mysql --version
            mysql Ver 15.1 Distrib 10.8.4-MariaDB, for Linux (x86_64) using readline 5.1
            {code}

            But also tested with the client included in the docker container, same result:
            {code:sh}
            $ docker exec -it 97795998875c bin/mysql --version
            bin/mysql Ver 15.1 Distrib 10.9.2-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper
            {code}
            JSON paths with dashes in them are reported as syntax errors inside procedures. If they are free-standing, they work fine.

            {code:sql}
            DROP PROCEDURE IF EXISTS my_proc;

            DELIMITER $$
            CREATE PROCEDURE my_proc()
            BEGIN
            DECLARE result TEXT;
            SET result = JSON_EXTRACT('{ "my-key": 1 }', '$."my-key"');
            END $$
            DELIMITER ;

            CALL my_proc();
            {code}

            {code:sql}
            --------------
            CALL my_proc()
            --------------

            ERROR 4042 (HY000) at line 11: Syntax error in JSON path in argument 2 to function 'json_extract' at position 6
            {code}

            This syntax works in procedures on MariaDB 10.9 (as tagged in dockerhub) and prior.

            More about the environment:
            {code:sh}
            $ cat /etc/os-release
            NAME='EndeavourOS'
            PRETTY_NAME='EndeavourOS'
            ID=endeavouros
            ID_LIKE=arch
            BUILD_ID=2021.04.17
            ANSI_COLOR="38;2;23;147;209"
            HOME_URL='https://endeavouros.com'
            DOCUMENTATION_URL='https://discovery.endeavouros.com'
            SUPPORT_URL='https://forum.endeavouros.com'
            BUG_REPORT_URL='https://forum.endeavouros.com/c/arch-based-related-questions/bug-reports'
            LOGO=endeavouros
            {code}

            Dockerized MariaDB:
            {code:sh}
            Server version: 10.9.2-MariaDB-1:10.9.2+maria~ubu2204 mariadb.org binary distribution
            {code}

            {code:sh}
            $ mysql --version
            mysql Ver 15.1 Distrib 10.8.4-MariaDB, for Linux (x86_64) using readline 5.1
            {code}

            But also tested with the client included in the docker container, same result:
            {code:sh}
            $ docker exec -it 97795998875c bin/mysql --version
            bin/mysql Ver 15.1 Distrib 10.9.2-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper
            {code}
            andrei-pavel Andrei Pavel made changes -
            Summary JSON paths containing dashes are reported as syntax errors. JSON paths containing dashes are reported as syntax errors in procedures
            andrei-pavel Andrei Pavel made changes -
            Environment EndeavorOS but with MariaDB 10.9.2 from Dockerhub container
            andrei-pavel Andrei Pavel made changes -
            Description JSON paths with dashes in them are reported as syntax errors inside procedures. If they are free-standing, they work fine.

            {code:sql}
            DROP PROCEDURE IF EXISTS my_proc;

            DELIMITER $$
            CREATE PROCEDURE my_proc()
            BEGIN
            DECLARE result TEXT;
            SET result = JSON_EXTRACT('{ "my-key": 1 }', '$."my-key"');
            END $$
            DELIMITER ;

            CALL my_proc();
            {code}

            {code:sql}
            --------------
            CALL my_proc()
            --------------

            ERROR 4042 (HY000) at line 11: Syntax error in JSON path in argument 2 to function 'json_extract' at position 6
            {code}

            This syntax works in procedures on MariaDB 10.9 (as tagged in dockerhub) and prior.

            More about the environment:
            {code:sh}
            $ cat /etc/os-release
            NAME='EndeavourOS'
            PRETTY_NAME='EndeavourOS'
            ID=endeavouros
            ID_LIKE=arch
            BUILD_ID=2021.04.17
            ANSI_COLOR="38;2;23;147;209"
            HOME_URL='https://endeavouros.com'
            DOCUMENTATION_URL='https://discovery.endeavouros.com'
            SUPPORT_URL='https://forum.endeavouros.com'
            BUG_REPORT_URL='https://forum.endeavouros.com/c/arch-based-related-questions/bug-reports'
            LOGO=endeavouros
            {code}

            Dockerized MariaDB:
            {code:sh}
            Server version: 10.9.2-MariaDB-1:10.9.2+maria~ubu2204 mariadb.org binary distribution
            {code}

            {code:sh}
            $ mysql --version
            mysql Ver 15.1 Distrib 10.8.4-MariaDB, for Linux (x86_64) using readline 5.1
            {code}

            But also tested with the client included in the docker container, same result:
            {code:sh}
            $ docker exec -it 97795998875c bin/mysql --version
            bin/mysql Ver 15.1 Distrib 10.9.2-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper
            {code}
            JSON paths with dashes in them are reported as syntax errors inside procedures. If they are free-standing, they work fine.

            {code:sql}
            DROP PROCEDURE IF EXISTS my_proc;

            DELIMITER $$
            CREATE PROCEDURE my_proc()
            BEGIN
            DECLARE result TEXT;
            SET result = JSON_EXTRACT('{ "my-key": 1 }', '$."my-key"');
            END $$
            DELIMITER ;

            CALL my_proc();
            {code}

            {code:sql}
            --------------
            CALL my_proc()
            --------------

            ERROR 4042 (HY000) at line 11: Syntax error in JSON path in argument 2 to function 'json_extract' at position 6
            {code}

            This syntax works in procedures on MariaDB 10.8.4 and prior.

            More about the environment:
            {code:sh}
            $ cat /etc/os-release
            NAME='EndeavourOS'
            PRETTY_NAME='EndeavourOS'
            ID=endeavouros
            ID_LIKE=arch
            BUILD_ID=2021.04.17
            ANSI_COLOR="38;2;23;147;209"
            HOME_URL='https://endeavouros.com'
            DOCUMENTATION_URL='https://discovery.endeavouros.com'
            SUPPORT_URL='https://forum.endeavouros.com'
            BUG_REPORT_URL='https://forum.endeavouros.com/c/arch-based-related-questions/bug-reports'
            LOGO=endeavouros
            {code}

            Dockerized MariaDB:
            {code:sh}
            Server version: 10.9.2-MariaDB-1:10.9.2+maria~ubu2204 mariadb.org binary distribution
            {code}

            {code:sh}
            $ mysql --version
            mysql Ver 15.1 Distrib 10.8.4-MariaDB, for Linux (x86_64) using readline 5.1
            {code}

            But also tested with the client included in the docker container, same result:
            {code:sh}
            $ docker exec -it 97795998875c bin/mysql --version
            bin/mysql Ver 15.1 Distrib 10.9.2-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper
            {code}
            alice Alice Sherepa made changes -
            Affects Version/s 10.9 [ 26905 ]
            Affects Version/s 10.10 [ 27530 ]
            alice Alice Sherepa made changes -
            Fix Version/s 10.9 [ 26905 ]
            Fix Version/s 10.10 [ 27530 ]
            alice Alice Sherepa made changes -
            Status Open [ 1 ] Confirmed [ 10101 ]
            alice Alice Sherepa made changes -
            Labels regression
            serg Sergei Golubchik made changes -
            Fix Version/s 10.10 [ 27530 ]
            serg Sergei Golubchik made changes -
            Affects Version/s 10.9.1 [ 27114 ]
            Affects Version/s 10.9 [ 26905 ]
            Affects Version/s 10.9.2 [ 27115 ]
            Affects Version/s 10.10 [ 27530 ]
            serg Sergei Golubchik made changes -
            serg Sergei Golubchik made changes -
            Assignee Rucha Deodhar [ rucha174 ]
            alice Alice Sherepa made changes -
            alice Alice Sherepa made changes -
            Francis.Dupont Francis Dupont made changes -
            Attachment mariadb-patch [ 67190 ]
            serg Sergei Golubchik made changes -
            Priority Major [ 3 ] Critical [ 2 ]
            rucha174 Rucha Deodhar made changes -
            Assignee Rucha Deodhar [ rucha174 ] Alexey Botchkov [ holyfoot ]
            Status Confirmed [ 10101 ] In Review [ 10002 ]
            rucha174 Rucha Deodhar made changes -
            Assignee Alexey Botchkov [ holyfoot ] Rucha Deodhar [ rucha174 ]
            rucha174 Rucha Deodhar made changes -
            Status In Review [ 10002 ] Stalled [ 10000 ]
            rucha174 Rucha Deodhar made changes -
            Component/s JSON [ 13908 ]
            Fix Version/s 10.9.5 [ 28519 ]
            Fix Version/s 10.9 [ 26905 ]
            Resolution Fixed [ 1 ]
            Status Stalled [ 10000 ] Closed [ 6 ]
            shenk Dave Shenk made changes -
            shenk Dave Shenk made changes -
            shenk Dave Shenk made changes -

            People

              rucha174 Rucha Deodhar
              andrei-pavel Andrei Pavel
              Votes:
              3 Vote for this issue
              Watchers:
              8 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.