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

select json_value('{"b":true}','$.b')=1 --> false with "Truncated incorrect DOUBLE value: 'true'"

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.2(EOL)
    • 10.2.16
    • JSON
    • None

    Description

      Hio,

      MariaDB [(none)]> select json_extract('{"b":true}','$.b')=1;
      +------------------------------------+
      | json_extract('{"b":true}','$.b')=1 |
      +------------------------------------+
      |                                  1 |
      +------------------------------------+
      1 row in set (0.00 sec)
       
      MariaDB [test]> select json_value('{"b":true}','$.b')=1;
      +----------------------------------+
      | json_value('{"b":true}','$.b')=1 |
      +----------------------------------+
      |                                0 |
      +----------------------------------+
      1 row in set, 1 warning (0.00 sec)
       
      MariaDB [(none)]> show warnings;
      +---------+------+------------------------------------------+
      | Level   | Code | Message                                  |
      +---------+------+------------------------------------------+
      | Warning | 1292 | Truncated incorrect DOUBLE value: 'true' |
      +---------+------+------------------------------------------+
      1 row in set (0.00 sec)
      
      

      But this works

      MariaDB [(none)]>  select json_value('{"b":"true"}','$.b')='true';
      +-----------------------------------------+
      | json_value('{"b":"true"}','$.b')='true' |
      +-----------------------------------------+
      |                                       1 |
      +-----------------------------------------+
      1 row in set (0.00 sec)
       
      MariaDB [(none)]> select json_value('{"b":true}','$.b')='true';
      +---------------------------------------+
      | json_value('{"b":true}','$.b')='true' |
      +---------------------------------------+
      |                                     1 |
      +---------------------------------------+
      1 row in set (0.00 sec)
      

      Attachments

        Issue Links

          Activity

            People

              holyfoot Alexey Botchkov
              Richard Richard Stracke
              Votes:
              1 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.