3
0

Change alteration merge to remove all found duplicates

Before it terminated too quickly so it would incloude half of the
duplicates.
This would cause a problem if we added multiple bits with the same
ident (nested record values for example).
This commit is contained in:
Tomaž Jerman
2023-06-25 13:20:46 +02:00
parent 3eb709b90a
commit 7a85cf3e1a
2 changed files with 12 additions and 2 deletions

View File

@@ -96,10 +96,12 @@ func (aa AlterationSet) Merge(bb AlterationSet) (cc AlterationSet) {
}
if a.compare(*aux[j]) {
if !found {
cc = append(cc, aux[j])
}
seen[j] = true
found = true
cc = append(cc, aux[j])
break
}
}

View File

@@ -89,6 +89,14 @@ func TestMerge(t *testing.T) {
},
},
},
&Alteration{
AttributeAdd: &AttributeAdd{
Attr: &Attribute{
Ident: "foo",
Type: &TypeJSON{Nullable: false},
},
},
},
},
cc: AlterationSet{
&Alteration{