dolt icon indicating copy to clipboard operation
dolt copied to clipboard

Three-way merge does not handle type changes

Open andy-wm-arthur opened this issue 2 years ago • 0 comments

merge operation succeeds and takes the correct schema modifications, but the data in the destination branch is not correctly modified

% dolt sql
# Welcome to the DoltSQL shell.
# Statements must be terminated with ';'.
# "exit" or "quit" (or Ctrl-D) to exit.
repro> create table integral (pk int primary key, c0 bigint);
repro> create table stringy (pk int primary key, c0 int);
repro> insert into integral values (1,1),(2,2),(3,3);
Query OK, 3 rows affected (0.00 sec)
repro> insert into stringy values (1,1),(2,2),(3,3);
Query OK, 3 rows affected (0.00 sec)
repro> call dcommit('-Am', 'ancestor');
+----------------------------------+
| hash                             |
+----------------------------------+
| 832756bm17702lp8e8kisao4bv01jita |
+----------------------------------+
1 row in set (0.00 sec)

repro> call dolt_branch('other');
+--------+
| status |
+--------+
| 0      |
+--------+
1 row in set (0.00 sec)

repro> insert into stringy values (9,9);
Query OK, 1 row affected (0.00 sec)
repro> insert into integral values (9,9);
Query OK, 1 row affected (0.00 sec)
repro> call dcommit('-am', 'msg');
+----------------------------------+
| hash                             |
+----------------------------------+
| unb4f6257nj9fguj5sjlu7d9q5aoi8pb |
+----------------------------------+
1 row in set (0.00 sec)

repro> call dcheckout('other');
+--------+
| status |
+--------+
| 0      |
+--------+
1 row in set (0.00 sec)

repro> alter table stringy modify column c0 varchar(120);
repro> alter table integral modify column c0 smallint;
repro> call dcommit('-am','msg');
+----------------------------------+
| hash                             |
+----------------------------------+
| iqrtmdts0i5ciphuq739g9lqqu9h8pkt |
+----------------------------------+
1 row in set (0.00 sec)

repro> call dcheckout('main');
+--------+
| status |
+--------+
| 0      |
+--------+
1 row in set (0.00 sec)

repro> call dolt_merge('other');
+--------------+-----------+
| fast_forward | conflicts |
+--------------+-----------+
| 0            | 0         |
+--------------+-----------+
1 row in set (0.00 sec)

both tables are corrupted:

repro> select * from stringy;
+----+-----+
| pk | c0  |
+----+-----+
| 1  | 1   |
| 2  | 2   |
| 3  | 3   |
| 9  | 	 |
+----+-----+
4 rows in set (0.00 sec)

repro> select * from integral;
panic in ExchangeIterPartitionRows: byte slice is not of expected size
repro>  

andy-wm-arthur avatar Oct 18 '22 00:10 andy-wm-arthur