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

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.2
    • Fix Version/s: 10.2.16
    • Component/s: JSON
    • Labels:
      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

              Assignee:
              holyfoot Alexey Botchkov
              Reporter:
              Richard Richard Stracke
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: