Skip to content

Commit

Permalink
Merge pull request #2588 from dolthub/taylor/version-fn
Browse files Browse the repository at this point in the history
Only register `version` function if it doesn't already exist
  • Loading branch information
tbantle22 authored Jul 9, 2024
2 parents c061ac3 + 9d70f93 commit 10da4b7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
12 changes: 8 additions & 4 deletions engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,14 @@ func New(a *analyzer.Analyzer, cfg *Config) *Engine {
ls := sql.NewLockSubsystem()

emptyCtx := sql.NewEmptyContext()
a.Catalog.RegisterFunction(emptyCtx, sql.FunctionN{
Name: "version",
Fn: function.NewVersion(cfg.VersionPostfix),
})

if fn, err := a.Catalog.Function(emptyCtx, "version"); fn == nil || err != nil {
a.Catalog.RegisterFunction(emptyCtx, sql.FunctionN{
Name: "version",
Fn: function.NewVersion(cfg.VersionPostfix),
})
}

a.Catalog.RegisterFunction(emptyCtx, function.GetLockingFuncs(ls)...)

ret := &Engine{
Expand Down
1 change: 0 additions & 1 deletion sql/information_schema/information_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -1946,7 +1946,6 @@ func tablesRowIter(ctx *Context, cat Catalog) (RowIter, error) {
}
}

// TODO: use different values for databases that support schemas
rows = append(rows, Row{
catalogName, // table_catalog
schemaName, // table_schema
Expand Down

0 comments on commit 10da4b7

Please sign in to comment.