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

information_schema.COLUMNS.COLUMN_DEFAULT returns the string "NULL" instead of SQL NULL for a nullable column with no default (MySQL incompatibility)

    XMLWordPrintable

Details

    • Not for Release Notes

    Description

      (for all server version)
      For a nullable column with no DEFAULT clause (or an explicit DEFAULT NULL), information_schema.columns COLUMN_DEFAULT is returned as the 4‑byte string "NULL", not NULL.
      This diverges from MySQL, which return NULL here, and breaks tools that use COLUMN_DEFAULT IS NULL to detect "no default."

      Repro:

      CREATE TABLE t (a INT);          -- nullable, no default
      SELECT column_default,
             column_default IS NULL AS is_sql_null,
             HEX(column_default)    AS bytes
      FROM information_schema.columns
      WHERE table_schema = DATABASE() AND table_name = 't' AND column_name = 'a';
      
      

      =>

      +----------------+-------------+----------+
      | column_default | is_sql_null | bytes    |
      +----------------+-------------+----------+
      | NULL           |           0 | 4E554C4C |
      +----------------+-------------+----------+
      
      

      Attachments

        Activity

          People

            serg Sergei Golubchik
            diego dupin Diego Dupin
            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.