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

JSON_VALUE broken in functions

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 10.2.21
    • Fix Version/s: N/A
    • Component/s: JSON
    • Labels:
      None
    • Environment:
      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

              Assignee:
              bar Alexander Barkov
              Reporter:
              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.