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:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -89,6 +89,14 @@ func TestMerge(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
&Alteration{
|
||||
AttributeAdd: &AttributeAdd{
|
||||
Attr: &Attribute{
|
||||
Ident: "foo",
|
||||
Type: &TypeJSON{Nullable: false},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
cc: AlterationSet{
|
||||
&Alteration{
|
||||
|
||||
Reference in New Issue
Block a user