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

Redundant NULL check are applied when create table with select from JSON_QUOTE or JSON_DEPTH

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Not a Bug
    • 13.1
    • N/A
    • JSON
    • None
    • Not for Release Notes

    Description

      Hi,

      I found that there will be redundant NULL checks in the column when creating a table with SELECT from JSON_QUOTE or JSON_DEPTH. There is an example:

      CREATE TABLE src_quote (fld VARCHAR(16) NOT NULL);
      CREATE TABLE dst_quote AS SELECT JSON_QUOTE(1) AS q FROM src_quote;
      SHOW CREATE TABLE dst_quote;
      -- dst_quote	CREATE TABLE `dst_quote` (
      --   `q` varchar(14) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL
      -- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
       
      CREATE TABLE src_depth (fld VARCHAR(16) NOT NULL);
      CREATE TABLE dst_depth AS
        SELECT JSON_DEPTH(fld) AS d
        FROM src_depth;
      SHOW CREATE TABLE dst_depth;
      -- dst_depth	CREATE TABLE `dst_depth` (
      --   `d` int(10) NOT NULL
      -- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
      

      Attachments

        Activity

          People

            shipjain Shipra Jain
            ChiZhang Chi Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.