diff --git a/go/vt/tabletserver/fakesqldb/conn.go b/go/vt/tabletserver/fakesqldb/conn.go index 34b149502a7..1894fe946d6 100644 --- a/go/vt/tabletserver/fakesqldb/conn.go +++ b/go/vt/tabletserver/fakesqldb/conn.go @@ -106,17 +106,20 @@ func (conn *Conn) ExecuteFetch(query string, maxrows int, wantfields bool) (*pro if qr.RowsAffected > uint64(maxrows) { return nil, fmt.Errorf("Row count exceeded %d", maxrows) } + if wantfields { copy(qr.Fields, result.Fields) } + rowCount := int(qr.RowsAffected) + rows := make([][]sqltypes.Value, rowCount) if rowCount > 0 { - rows := make([][]sqltypes.Value, rowCount) for i := 0; i < rowCount; i++ { rows[i] = result.Rows[i] } - qr.Rows = rows } + qr.Rows = rows + return qr, nil } diff --git a/go/vt/tabletserver/schema_info_test.go b/go/vt/tabletserver/schema_info_test.go index a14295206aa..52659589311 100644 --- a/go/vt/tabletserver/schema_info_test.go +++ b/go/vt/tabletserver/schema_info_test.go @@ -809,7 +809,7 @@ func handleAndVerifySchemaInfoError(t *testing.T, msg string, tabletErrType int) } tabletError, ok := err.(*TabletError) if !ok { - t.Fatalf("should return a TabletError") + t.Fatalf("should return a TabletError, but got err: %v", err) } if tabletError.ErrorType != tabletErrType { t.Fatalf("should return a TabletError with error type: %s", getTabletErrorString(tabletErrType))