fixed TableDelta.IsKeyless()

This commit is contained in:
Andy Arthur
2020-12-17 13:01:12 -08:00
parent fadf5f692e
commit 74bb15f412
3 changed files with 6 additions and 5 deletions

View File

@@ -189,6 +189,7 @@ SQL
run dolt --keyless sql -q "
SELECT to_c0, to_c1, from_c0, from_c1
FROM dolt_diff_keyless
WHERE from_commit = hashof('HEAD')
ORDER BY to_commit_date" -r csv
[ $status -eq 0 ]
[[ "${lines[0]}" = "to_c0,to_c1,from_c0,from_c1" ]] || false
@@ -198,10 +199,6 @@ SQL
[[ "${lines[4]}" = "1,9,," ]] || false
[[ "${lines[5]}" = "1,9,," ]] || false
[[ "${lines[6]}" = ",,0,0" ]] || false
[[ "${lines[7]}" = "1,1,," ]] || false
[[ "${lines[8]}" = "1,1,," ]] || false
[[ "${lines[9]}" = "0,0,," ]] || false
[[ "${lines[10]}" = "2,2,," ]] || false
}
@test "keyless diff column add/drop" {

View File

@@ -641,6 +641,9 @@ func diffRows(ctx context.Context, td diff.TableDelta, dArgs *diffArgs) errhand.
if err != nil {
return errhand.BuildDError("cannot retrieve schema for table %s", td.ToName).AddCause(err).Build()
}
if td.IsAdd() {
fromSch = toSch
}
fromRows, toRows, err := td.GetMaps(ctx)
if err != nil {

View File

@@ -55,7 +55,8 @@ func ExtractAllColNames(sch Schema) (map[uint64]string, error) {
}
func IsKeyless(sch Schema) bool {
return sch.GetPKCols().Size() == 0
return sch.GetPKCols().Size() == 0 &&
sch.GetAllCols().Size() != 0
}
// TODO: this function never returns an error