dolt icon indicating copy to clipboard operation
dolt copied to clipboard

Dolt says constraint violation on merge when one does not exist

Open timsehn opened this issue 3 years ago • 0 comments

Repro:

dolt clone https://doltremoteapi.awsdev.ld-corp.com/liuliu/test
cloning https://doltremoteapi.awsdev.ld-corp.com/liuliu/test
$ cd test
$ dolt ls
Tables in working set:
	 debug
	 test_unique
	 test_varchar_text_display

$ dolt sql -q "show create table test_unique"
+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table       | Create Table                                                                                                                                                                                        |
+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| test_unique | CREATE TABLE `test_unique` (
  `id` int NOT NULL,
  `val` int,
  PRIMARY KEY (`id`),
  UNIQUE KEY `test_unique_val_unique` (`val`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin |
+-------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

$ dolt merge origin/test
Updating ginnmhimd8pb3ho051eocqm0i71jtf6s..ph1c8o2aktrvn4n60s65is4ndp8of19t
Auto-merging test_unique
CONSTRAINT VIOLATION (content): Merge created constraint violation in test_unique
Automatic merge failed; 1 table(s) are unmerged.
Fix constraint violations and then commit the result.
Constraint violations for the working set may be viewed using the 'dolt_constraint_violations' system table.
They may be queried and removed per-table using the 'dolt_constraint_violations_TABLENAME' system table.
$ dolt sql -q "select * from dolt_constraint_violations_test_unique"
+----------------+------------+-----+--------------------------------------------------------+
| violation_type | id         | val | violation_info                                         |
+----------------+------------+-----+--------------------------------------------------------+
| unique index   | 1450980457 | 4   | {"Columns": ["val"], "Name": "test_unique_val_unique"} |
+----------------+------------+-----+--------------------------------------------------------+
$ dolt sql -q "select * from test_unique"
+------------+-----+
| id         | val |
+------------+-----+
| 6108052    | 8   |
| 140283486  | 0   |
| 987505750  | 1   |
| 1418582707 | 55  |
| 1450980457 | 4   |
| 1701000969 | 3   |
| 1809485795 | 9   |
| 1823452792 | 6   |
| 2072252360 | 7   |
+------------+-----+

$ dolt sql -q "select * from test_unique as of 'origin/test'"
+------------+-----------+
| id         | val       |
+------------+-----------+
| 6108052    | 8         |
| 140283486  | 0         |
| 528716705  | 25573532  |
| 987505750  | 1         |
| 1418582707 | 55        |
| 1450980457 | 4         |
| 1701000969 | 3         |
| 1809485795 | 531671667 |
| 1823452792 | 6         |
| 2072252360 | 7         |
+------------+-----------+

$ dolt diff HEAD origin/test                                 
diff --dolt a/test_unique b/test_unique
--- a/test_unique @ 042e0pohhdijgisvqf8geeb0q798vr6k
+++ b/test_unique @ s0gqkrjkjrt8nibd87bc7osrgg21cold
+---+------------+-----------+
|   | id         | val       |
+---+------------+-----------+
| + | 528716705  | 25573532  |
| < | 1809485795 | 9         |
| > | 1809485795 | 531671667 |
+---+------------+-----------+

timsehn avatar Oct 13 '22 21:10 timsehn