Skip to content

Commit

Permalink
Merge pull request #1019 from dolthub/james/uuid
Browse files Browse the repository at this point in the history
UUID function is no longer based off current time
  • Loading branch information
jycor authored May 18, 2022
2 parents fbd5e8b + fc7ab64 commit d635025
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 6 additions & 0 deletions enginetest/queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -6797,6 +6797,12 @@ var QueryTests = []QueryTest{
Query: `show function status where Db='mydb'`,
Expected: []sql.Row{},
},
{
Query: `select uuid() = uuid()`,
Expected: []sql.Row{
{false},
},
},
}

var KeylessQueries = []QueryTest{
Expand Down
7 changes: 1 addition & 6 deletions sql/expression/function/uuid.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,7 @@ func (u UUIDFunc) Type() sql.Type {
}

func (u UUIDFunc) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {
nUUID, err := uuid.NewUUID()
if err != nil {
return nil, err
}

return nUUID.String(), nil
return uuid.New().String(), nil
}

func (u UUIDFunc) WithChildren(children ...sql.Expression) (sql.Expression, error) {
Expand Down

0 comments on commit d635025

Please sign in to comment.