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

Non-deferrable uniqueness constraints are always checked immediately

    XMLWordPrintable

    Details

      Description

      The following, as expected, produces an error in all versions:

      create table t (n int not null unique);
      insert into t values(1);
      insert into t values(2);
      update t set n=n+1;
      ERROR 1062 (23000): Duplicate entry '2' for key 'n'
      

      However, the above runs without error in Oracle and the SQL standard suggests that non-deferrable uniqueness constraints should be checked only at the end of the statement. PostgreSQL, MySQL, Firebird all behave as MariaDB does. DB2 behaves as Oracle does. Should this be changed for Oracle mode?

        Attachments

          Activity

            People

            Assignee:
            monty Michael Widenius
            Reporter:
            greenman Ian Gilfillan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: