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

Error instead of warning if NULL is in first row during LOAD

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Not a Bug
    • 10.6.5
    • N/A
    • None
    • Debian unstable

    Description

      Hi

      Assuming STRICT_ALL_TABLES is not set and the column is specified as NOT NULL then MariaDB behaves differently depending in the order of the data during LOAD.

      Here is how to reproduce (There is also a script attached)

      DROP TABLE IF EXISTS bugtable;
      CREATE TABLE bugtable (id INT NOT NULL) ENGINE=MyISAM;
       
      -- this works with warning
      LOAD DATA INFILE '/tmp/data-with-warning.txt' INTO TABLE bugtable;
      -- this does not work - gives erros
      LOAD DATA INFILE '/tmp/data-with-error.txt' INTO TABLE bugtable;
      

      The file /tmp/data-with-warning.txt

      1
      \N
      

      Warning (Code 1263): Column set to default value; NULL supplied to NOT NULL column 'id' at row 2

      The file /tmp/data-with-error.txt

      \N
      1
      

      ERROR 1263 (22004) at line 1: Column set to default value; NULL supplied to NOT NULL column 'id' at row 1

      Expected result:

      SELECT * FROM bugtable;
      1
      0
      0
      1
      

      Note: Specifying DEFAULT 0 during table creation does not alter the inconsistent behavior.

      Attachments

        Activity

          People

            serg Sergei Golubchik
            vasvir Vassilis Virvilis
            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.