mirror of
https://github.com/dolthub/dolt.git
synced 2026-02-05 02:59:44 -06:00
fixed TableDelta.IsKeyless()
This commit is contained in:
@@ -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" {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user