[MDEV-22587] Bad error (message) upon violating WITHOUT OVERLAPS constraint Created: 2020-05-15  Updated: 2020-10-22

Status: Open
Project: MariaDB Server
Component/s: Versioned Tables
Affects Version/s: 10.5
Fix Version/s: 10.5

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Nikita Malyavin
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates

 Description   

create or replace table t1 (a int, s date, e date, period for p(s,e), primary key (a, p without overlaps));
insert into t1 values (1,'2012-01-01','2020-01-01');
insert into t1 values (1,'2016-06-06','2018-08-08');

10.5 f544a712

ERROR 1062 (23000): Duplicate entry '1-2018-08-08-2016-06-06' for key 'PRIMARY'

There should be an error, as the value of a is the same and periods overlap. Whether it should be the ER_DUP_ENTRY is arguable. We discussed it and agreed to disagree, so apparently it will remain such.

But the error message is undeniably wrong. There is no duplicate entry 1-2018-08-08-2016-06-06. This is going to be very confusing to whoever uses the feature. It needs to be changed to something more sensible.



 Comments   
Comment by Nikita Malyavin [ 2020-06-01 ]

probably, adopt the message to more convenient one, but leave the code ER_DUP_ENTRY

Comment by Nikita Malyavin [ 2020-10-22 ]

elenst There is a duplicate, and the key is unique, so there's no surprise it says it's a duplicate.
I really don't want to add a new error code for it (imagine how many ORMs will be confused), and I can't change the text from "Duplicate" to "Overlapping" or something, because it will not be translated then.

I can propose to change key to something like '1 (2016-06-06, 2018-08-08)', for example. A period duplicated will be in the brackets.

Generated at Thu Feb 08 09:15:54 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.