sqlite3_sqlean_init: load define last - #162
Merged
nalgeon merged 1 commit intoJun 11, 2026
Merged
Conversation
define_init calls define_load which prepares every stored UDF body as a SQLite statement. If a UDF body references a sqlean function (e.g. uuid_str) that has not yet been registered, sqlite3_prepare_v3 fails with SQLITE_ERROR and the error is emitted to the global SQLite log. The failure is silently swallowed by define_load (it returns sqlite3_finalize rather than the error code), so sqlite3_load_extension still succeeds, but the UDF is not registered and must be re-run via functions.sql on first open. Move define_init to after all other extension inits so that every sqlean function is already registered when define_load prepares the stored UDF bodies. Add a comment explaining the ordering constraint.
DragonRulerX
force-pushed
the
jhinze/fix-module-load-ordering
branch
from
June 10, 2026 21:50
b13d32e to
4f2b8f0
Compare
Owner
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #161
Move
define_initto after all other extension inits so that everysqleanfunction is already registered whendefine_loadprepares the stored UDF bodies within thesqlean_definetable.