dolthub / dolthub/dolt

`dolt conflicts cat` has extra columns

Open
#9,173 0 comments 0 reactions 1 assignee Claimed by @NathanGabrielson View on GitHub
bug cli
Dominant language
Go
Stars
24.4k
Forks
873
Avg merge
1d 8h
Merged PRs (30d)
120

Description

If I create a simple conflict on column `col1`, `dolt conflict cat .` has extra columns that are NULL

```sql
taylor@MacBook-Pro-6 test-conflicts % dolt conflicts cat test
+-----+--------+----+------+------+------+------+------+
| | | id | col1 | id | col1 | id | col1 |
+-----+--------+----+------+------+------+------+------+
| | base | 1 | one | NULL | NULL | NULL | NULL |
| * | ours | 1 | uno | NULL | NULL | NULL | NULL |
| * | theirs | 1 | uma | NULL | NULL | NULL | NULL |
+-----+--------+----+------+------+------+------+------+
```

To repro, create a table, insert a row, create two branches, change the same column on each branch, attempt to merge both to main
```sql
test-conflicts/main> create table test (id int primary key, col1 text);
test-conflicts/main*> insert into test values (1, 'one'), (2, 'two');
Query OK, 2 rows affected (0.01 sec)
test-conflicts/main*> call dolt_commit('-Am', 'Add test table');
+----------------------------------+
| hash |
+----------------------------------+
| 42jh7c801v5809efr4256vobutuh4c9l |
+----------------------------------+
1 row in set (0.01 sec)

test-conflicts/main> call dolt_branch('one');
+--------+
| status |
+--------+
| 0 |
+--------+
1 row in set (0.01 sec)

test-conflicts/main> call dolt_branch('two');
+--------+
| status |
+--------+
| 0 |
+--------+
1 row in set (0.01 sec)

test-conflicts/main> call dolt_checkout('one');
+--------+--------------------------+
| status | message |
+--------+--------------------------+
| 0 | Switched to branch 'one' |
+--------+--------------------------+
1 row in set (0.00 sec)

test-conflicts/one> update test set col1='uno' where id=1;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
test-conflicts/one*> call dolt_commit('-Am', 'First update');
+----------------------------------+
| hash |
+----------------------------------+
| iasffejc159occvnbqti5c2cg2s5ndh1 |
+----------------------------------+
1 row in set (0.01 sec)

test-conflicts/one> call dolt_checkout('two');
+--------+--------------------------+
| status | message |
+--------+--------------------------+
| 0 | Switched to branch 'two' |
+--------+--------------------------+
1 row in set (0.00 sec)

test-conflicts/two> update test set col1='uma' where id=1;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
test-conflicts/two*> call dolt_commit('-Am', 'Second update');
+----------------------------------+
| hash |
+----------------------------------+
| 1dpgji9qi40upptq7etmun36lsqh9dp2 |
+----------------------------------+
1 row in set (0.01 sec)

test-conflicts/two> call dolt_checkout('main');
+--------+---------------------------+
| status | message |
+--------+---------------------------+
| 0 | Switched to branch 'main' |
+--------+---------------------------+
1 row in set (0.00 sec)

test-conflicts/main> call dolt_merge('one');
+----------------------------------+--------------+-----------+------------------+
| hash | fast_forward | conflicts | message |
+----------------------------------+--------------+-----------+------------------+
| iasffejc159occvnbqti5c2cg2s5ndh1 | 1 | 0 | merge successful |
+----------------------------------+--------------+-----------+------------------+
1 row in set (0.01 sec)

test-conflicts/main> set @@dolt_allow_commit_conflicts = 1;
test-conflicts/main> call dolt_merge('two');
+------+--------------+-----------+-----------------+
| hash | fast_forward | conflicts | message |
+------+--------------+-----------+-----------------+
| | 0 | 1 | conflicts found |
+------+--------------+-----------+-----------------+
1 row in set (0.00 sec)

```

SQL interface looks right
```sql
test-conflicts/main*> select * from dolt_conflicts;
+-------+---------------+
| table | num_conflicts |
+-------+---------------+
| test | 1 |
+-------+---------------+
1 row in set (0.00 sec)

test-conflicts/main*> select * from dolt_conflicts_test;
+----------------------------------+---------+-----------+--------+----------+---------------+----------+------------+-----------------+------------------------+
| from_root_ish | base_id | base_col1 | our_id | our_col1 | our_diff_type | their_id | their_col1 | their_diff_type | dolt_conflict_id |
+----------------------------------+---------+-----------+--------+----------+---------------+----------+------------+-----------------+------------------------+
| 1dpgji9qi40upptq7etmun36lsqh9dp2 | 1 | one | 1 | uno | modified | 1 | uma | modified | Hu+PaYowY7xyM193R5SZfA |
+----------------------------------+---------+-----------+--------+----------+---------------+----------+------------+-----------------+------------------------+
1 row in set (0.00 sec)
```

`dolt conflicts cat ` has extra columns
```
test-conflicts % dolt conflicts cat .
+-----+--------+----+------+------+------+------+------+
| | | id | col1 | id | col1 | id | col1 |
+-----+--------+----+------+------+------+------+------+
| | base | 1 | one | NULL | NULL | NULL | NULL |
| * | ours | 1 | uno | NULL | NULL | NULL | NULL |
| * | theirs | 1 | uma | NULL | NULL | NULL | NULL |
+-----+--------+----+------+------+------+------+------+
test-conflicts % dolt conflicts cat test
+-----+--------+----+------+------+------+------+------+
| | | id | col1 | id | col1 | id | col1 |
+-----+--------+----+------+------+------+------+------+
| | base | 1 | one | NULL | NULL | NULL | NULL |
| * | ours | 1 | uno | NULL | NULL | NULL | NULL |
| * | theirs | 1 | uma | NULL | NULL | NULL | NULL |
+-----+--------+----+------+------+------+------+------+
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.