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

Valid values (zero and false) appear as NULL (CONNECT JSON)

    Details

      Description

      When json file contains 0 or "false" values, CONNECT JSON type shows them as NULL, unless a column declared explicitly as not null.

      MariaDB [test]> \! cat /home/alice/Downloads/3.json
        [
          {
              "i1": 0,
              "i2": false,
              "i3": null
          }
      ]
      MariaDB [test]>source /home/alice/t/c.sql
      Show warnings enabled.
      --------------
       
      create table t1(
      	i1 int,
              i2 int,
              i3 int
      )engine=CONNECT table_type=JSON  File_name='/home/alice/Downloads/3.json'
      --------------
      Query OK, 0 rows affected (0.07 sec)
       
      --------------
      select * from t1
      --------------
      +------+------+------+
      | i1   | i2   | i3   |
      +------+------+------+
      | NULL | NULL | NULL |
      +------+------+------+
      1 row in set (0.00 sec)
       
      create table t2(
      	i1 int not null,
              i2 int not null,
              i3 int
      )engine=CONNECT table_type=JSON  File_name='/home/alice/Downloads/3.json'
      --------------
      Query OK, 0 rows affected (0.05 sec)
       
      --------------
      select * from t2
      --------------
      +----+----+------+
      | i1 | i2 | i3   |
      +----+----+------+
      |  0 |  0 | NULL |
      +----+----+------+
      1 row in set (0.00 sec)
      

        Attachments

          Activity

            People

            • Assignee:
              bertrandop Olivier Bertrand
              Reporter:
              alice Alice Sherepa
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: