-
Notifications
You must be signed in to change notification settings - Fork 81
Closed
Description
Registering different UDF functions in different databases but with the same name doesn't work and silently gives a wrong result:
using SQLite
using DBInterface: execute
db_a = SQLite.DB(":memory:")
db_b = SQLite.DB(":memory:")
SQLite.register(db_a, x -> 2x, name="myfunc")
SQLite.register(db_b, x -> 10x, name="myfunc")
@show first(execute(db_a, """select myfunc(1) as x""")) # shows 10 (should be 2)
@show first(execute(db_b, """select myfunc(1) as x""")) # shows 10 (as it should)
As I understand, it's due to this line:
Line 54 in 4b22cc4
function $(nm)( |
Definitions with the function
keyword are global in Julia, and SQLite.jl defines function myfunc(x)
in both cases above. Can this be an anonymous function instead? I think it would fix the bug.
Metadata
Metadata
Assignees
Labels
No labels