diff --git a/go/libraries/doltcore/schema/col_coll.go b/go/libraries/doltcore/schema/col_coll.go index 021d749442..4b72d5809a 100644 --- a/go/libraries/doltcore/schema/col_coll.go +++ b/go/libraries/doltcore/schema/col_coll.go @@ -245,7 +245,9 @@ func ColCollsAreEqual(cc1, cc2 *ColCollection) bool { } // Pks Cols need to be in the same order and equivalent. for i := 0; i < cc1.Size(); i++ { - if !cc1.cols[i].Equals(cc2.cols[i]) { + // Test that the columns are identical, but don't worry about tags matching, since + // different tags could be generated depending on how the schemas were created. + if !cc1.cols[i].EqualsWithoutTag(cc2.cols[i]) { return false } } diff --git a/go/libraries/doltcore/schema/column.go b/go/libraries/doltcore/schema/column.go index cc7f8971a7..3b94faad95 100644 --- a/go/libraries/doltcore/schema/column.go +++ b/go/libraries/doltcore/schema/column.go @@ -145,6 +145,16 @@ func (c Column) Equals(other Column) bool { ColConstraintsAreEqual(c.Constraints, other.Constraints) } +// EqualsWithoutTag tests equality between two columns, but does not check the columns' tags. +func (c Column) EqualsWithoutTag(other Column) bool { + return c.Name == other.Name && + c.Kind == other.Kind && + c.IsPartOfPK == other.IsPartOfPK && + c.TypeInfo.Equals(other.TypeInfo) && + c.Default == other.Default && + ColConstraintsAreEqual(c.Constraints, other.Constraints) +} + // Compatible tests compatibility between two columns. Compatible columns have the same tag and can store the same // kinds of values at the storage layer, but may have different constraints or type parameters. func (c Column) Compatible(other Column) bool { diff --git a/integration-tests/bats/column_tags.bats b/integration-tests/bats/column_tags.bats index 4b01445192..542f2a850b 100644 --- a/integration-tests/bats/column_tags.bats +++ b/integration-tests/bats/column_tags.bats @@ -325,7 +325,7 @@ DELIM [[ $output =~ "col1 | 6" ]] || false } -@test "column_tags: create table on two separate branches, merge them together by updating tags" { +@test "column_tags: create table on two separate branches, merge them together even though they have different tags" { skip_nbf_not_dolt dolt branch other @@ -344,23 +344,7 @@ DELIM dolt sql -q "ALTER TABLE target DROP COLUMN badCol;" dolt commit -Am "fixup" - run dolt schema tags - [[ $output =~ "| target | col1 | 14690 |" ]] || false - dolt checkout main - - run dolt schema tags - [ $status -eq 0 ] - [[ $output =~ "| target | col1 | 14649 |" ]] || false - - run dolt merge other - [ $status -ne 0 ] - [[ $output =~ "table with same name 'target' added in 2 commits can't be merged" ]] || false - dolt reset --hard - - dolt schema update-tag target col1 14690 - dolt commit -am "update tag of col1 of target" - run dolt merge other -m "merge other into main" [ $status -eq 0 ] [[ $output =~ "1 tables changed, 1 rows added(+)" ]] || false