Details

    • Type: Task
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Fix Version/s: 10.3, 10.4
    • Component/s: Server
    • Labels:
      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

              • Assignee:
                Unassigned
                Reporter:
                nirbhay_c Nirbhay Choubey (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: