Sergei, here's another example:

create or replace table t(a int not null auto_increment,
                          b int,
                          primary key (a, b));
insert t(b) values (1);
insert t(b) values (2);
select * from t;

a       b
1       1
2       2

However there's no collision! Switching key parts ordering to (b,a)
changes the behavior.

I am still struggling with this because

create or replace table cars(id int unique auto_increment,
                             price int, s date, e date,
                             period for p(s,e),
                             primary key(id, p without overlaps));

has primary key as an autoincrement index! And as a consequence, the
following fails:

insert cars(price, s, e) values (1000, '2018-01-01', '2020-01-01');
insert cars(price, s, e) values (1000, '2021-01-01', '2022-01-01');

update cars for portion of p from '2019-01-01' to '2019-12-01' set price= 1100;

As you may guess, the same applies to the table t, if we'd add
unique(a) - it doesn't become the autoincrement
index in the code, but the behavior is the same...

Should I maybe update the key determination rules for such case?


-- 
Yours truly,
Nikita Malyavin
_______________________________________________
developers mailing list -- developers@lists.mariadb.org
To unsubscribe send an email to developers-le...@lists.mariadb.org

Reply via email to