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

JSON_VALUE broken in functions

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Duplicate
    • 10.2.21
    • N/A
    • JSON
    • None
    • Ubuntu 16.04 x64

    Description

      We have found a serious problem with JSON_VALUE which apparently was partially fixed in 10.2.16. Specifically we're extracting a Date from JSON and if that extraction is in a function it does not work.

      ERROR: Truncated incorrect datetime value: '2018-07-26T00:00:00+03:00'

      If the extraction is done from the query (ie no function that does it) then it works fine.

      Please see the following example:

      SET NAMES 'utf8';
       
      USE import;
       
      DELIMITER $$
       
      CREATE DEFINER = 'jsupport'@'10.8.0.%'
      FUNCTION J_SON ()
      RETURNS date
      BEGIN
       
        RETURN (SELECT
            date (JSON_VALUE('{"b":"2018-07-26T00:00:00+03:00"}', '$.b')));
       
      END
      $$
       
      DELIMITER ;
      

      -- WORKING -> SELECT date (JSON_VALUE('{"b":"2018-07-26T00:00:00+03:00"}', '$.b'));
      -- BROKEN    -> SELECT J_SON();
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              Ravenheart Toshko Andreev
              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.