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

JSON boolean values are not automatically converted to TINYINT(1)

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Won't Fix
    • 10.2.11
    • N/A
    • JSON
    • None

    Description

      CREATE TABLE IF NOT EXISTS `json_boolean` (
          `id` INT(11) UNSIGNED AUTO_INCREMENT,
          `json` JSON NOT NULL,
          `value` TINYINT(1) AS (JSON_VALUE(json, '$.value')) PERSISTENT,
          PRIMARY KEY (`id`)
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
      

      MariaDB> INSERT INTO json_boolean (`json`) VALUES ('{"value":true}');
      ERROR 1366 (22007): Incorrect integer value: 'true' for column 'value' at row 1
      

      Since BOOLEAN is an alias for TINYINT(1) I think it would make sense that JSON booleans automatically work as such as well.

      Attachments

        Activity

          People

            serg Sergei Golubchik
            pprkut Heinz Wiesinger
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.