dolt icon indicating copy to clipboard operation
dolt copied to clipboard

Complex schema merge incorrectly flagged as conflict.

Open nicktobey opened this issue 1 year ago • 1 comments

Steps to reproduce:

git checkout nicktobey/schemarepro
go test libraries/doltcore/merge/schema_merge_test.go -run "^\QTestSchemaMerge\E$/^\Qcolumn_type_change_tests\E$"

It seems that dropping a column can affect the tag of other columns in a table. Tags are an internal identifier that we use to recognize columns across branches. If the tag changes, we may perceive the same column in two branches as different and result in a schema conflict.

nicktobey avatar Nov 16 '23 22:11 nicktobey

The merge in question:

ancestor: 
"CREATE TABLE t (id int PRIMARY KEY, a varchar(20), b int, c varchar(20))"

left:
"CREATE TABLE t (id int PRIMARY KEY, a text, b int, c text)"

right:
"CREATE TABLE t (id int PRIMARY KEY, a varchar(20), c varchar(20))"

merged:
"CREATE TABLE t (id int PRIMARY KEY, a text, c text)"

The left side alters the columns a and c, while the right side drops column b.

nicktobey avatar Nov 16 '23 22:11 nicktobey