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

isnull(COLUMN_DEFAULT) from information_schema.columns

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Not a Bug
    • 10.6.16
    • N/A
    • Data types
    • None
    • 10.6.16-MariaDB-0ubuntu0.22.04.1 Ubuntu 22.04

    Description

      I create a table with this definition:

      create table pi_sets ( 
      id                   bigint unsigned          NOT NULL,  
      date                 timestamp(6)             NOT NULL  
                           default current_timestamp, 
      comment              varchar(800)             NOT NULL 
                           default '', 
      editor               varchar(80), 
      editing              varchar(10)              NOT NULL 
                           default '-', 
      status               varchar(10)              NOT NULL 
                           default 'Unknown',     
      PRIMARY KEY (id) 
      ); 
      

      and when I ask this question:

      select COLUMN_NAME, COLUMN_DEFAULT from information_schema.columns 
      where TABLE_SCHEMA = 'x' 
      and TABLE_NAME = 'pi_sets' order by ORDINAL_POSITION;
      

      I get the ok answer:

      +-------------+----------------------+
      | COLUMN_NAME | COLUMN_DEFAULT       |
      +-------------+----------------------+
      | id          | NULL                 |
      | date        | current_timestamp(6) |
      | comment     | ''                   |
      | editor      | NULL                 |
      | editing     | '-'                  |
      | status      | 'Unknown'            |
      +-------------+----------------------+
      

      But when I ask this question:

      select COLUMN_NAME, isnull(COLUMN_DEFAULT) from information_schema.columns 
      where TABLE_SCHEMA = 'x' 
      and TABLE_NAME = 'pi_sets' order by ORDINAL_POSITION ;
      

      I get the strange result:

      +-------------+------------------------+
      | COLUMN_NAME | isnull(COLUMN_DEFAULT) |
      +-------------+------------------------+
      | id          |                      1 |
      | date        |                      0 |
      | comment     |                      0 |
      | editor      |                      0 |
      | editing     |                      0 |
      | status      |                      0 |
      +-------------+------------------------+
      

      Shouldn't id and editor have the same value here?

      Attachments

        Activity

          People

            Unassigned Unassigned
            anders.r.gson Anders Gustavsson
            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.