XMLWordPrintable

Details

    • Task
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 10.4
    • Server
    • None

    Description

      While INSERT, UPDATE, DELETE and LOAD DATA INFILE all support
      IGNORE construct, REPLACE does not have this option.

      MariaDB [test]> select @@sql_mode;
      +---------------------+
      | @@sql_mode          |
      +---------------------+
      | STRICT_TRANS_TABLES |
      +---------------------+
      1 row in set (0.00 sec)
       
      MariaDB [test]> create table t1(i int primary key, j varchar(10)) engine=innodb;
      Query OK, 0 rows affected (0.03 sec)
       
      MariaDB [test]> insert into t1 values('aaa', 'bbb');
      ERROR 1366 (22007): Incorrect integer value: 'aaa' for column 'i' at row 1
       
      MariaDB [test]> insert into t1 values('aaa', 'bbb');
      ERROR 1366 (22007): Incorrect integer value: 'aaa' for column 'i' at row 1
       
      MariaDB [test]> insert ignore into t1 values('aaa', 'bbb');
      Query OK, 1 row affected, 1 warning (0.01 sec)
       
      MariaDB [test]> show warnings;
      +---------+------+--------------------------------------------------------+
      | Level   | Code | Message                                                |
      +---------+------+--------------------------------------------------------+
      | Warning | 1366 | Incorrect integer value: 'aaa' for column 'i' at row 1 |
      +---------+------+--------------------------------------------------------+
      1 row in set (0.00 sec)
       
      MariaDB [test]> select * from t1;
      +---+------+
      | i | j    |
      +---+------+
      | 0 | bbb  |
      +---+------+
      1 row in set (0.00 sec)
       
      MariaDB [test]> replace into t1 values('aaa', 'bbb');
      ERROR 1366 (22007): Incorrect integer value: 'aaa' for column 'i' at row 1
       
      MariaDB [test]> replace ignore into t1 values('aaa', 'bbb');
      ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ignore into t1 values('aaa', 'bbb')' at line 1
      

      KB : https://mariadb.com/kb/en/mariadb/ignore/

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              nirbhay_c Nirbhay Choubey (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.