Skip to content

Commit

Permalink
Fixed spurious error message for event scheduling when the dolt_schem…
Browse files Browse the repository at this point in the history
…as table doesn't exist.
  • Loading branch information
zachmu committed Jan 17, 2024
1 parent 6f3f5f2 commit ee0270d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion go/libraries/doltcore/sqle/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -1353,6 +1353,12 @@ func (db Database) GetEvents(ctx *sql.Context) (events []sql.EventDefinition, to

// NeedsToReloadEvents implements sql.EventDatabase.
func (db Database) NeedsToReloadEvents(ctx *sql.Context, token interface{}) (bool, error) {
// A nil token means no events in this db. If the dolt_schemas table doesn't exist, it will have a zero hash below
// as well, meaning we don't reload events in that case.
if token == nil {
token = hash.Hash{}
}

hash, ok := token.(hash.Hash)
if !ok {
return false, fmt.Errorf("expected token to be hash.Hash, but received %T", token)
Expand All @@ -1362,7 +1368,7 @@ func (db Database) NeedsToReloadEvents(ctx *sql.Context, token interface{}) (boo
if err != nil {
return false, err
}

// If the current hash doesn't match what we last loaded, then we
// need to reload event definitions
return !tableHash.Equal(hash), nil
Expand Down

0 comments on commit ee0270d

Please sign in to comment.