-
Notifications
You must be signed in to change notification settings - Fork 339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bugfix: reset modifications of sqlite3_vtab
#1027
Merged
Merged
Conversation
This file contains 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
avinassh
changed the title
Remove
bugfix: reset modifications of Feb 15, 2024
libsql_module
field from sqlite3_vtab
sqlite3_vtab
avinassh
force-pushed
the
865-sqlite-vtab
branch
5 times, most recently
from
February 15, 2024 13:49
6cb741c
to
040f6bb
Compare
Also removed the associated functions `libsql_create_module_v2`, `libsql_create_module` functions'. The `libsql_module` had a function `xPreparedSql` which is now moved to `sqlite_module`. The `sqlite_module` might get changed in the upstream, so added some padding space for our custom functions
avinassh
force-pushed
the
865-sqlite-vtab
branch
3 times, most recently
from
February 15, 2024 16:52
069b1e5
to
3201e83
Compare
avinassh
force-pushed
the
865-sqlite-vtab
branch
from
February 15, 2024 17:01
3201e83
to
73ffb24
Compare
avinassh
force-pushed
the
865-sqlite-vtab
branch
from
February 15, 2024 17:18
c172eaa
to
13c1682
Compare
avinassh
force-pushed
the
865-sqlite-vtab
branch
from
February 15, 2024 17:38
13c1682
to
4ecfcb0
Compare
glommer
approved these changes
Feb 15, 2024
This was referenced Feb 16, 2024
penberg
added a commit
that referenced
this pull request
Oct 21, 2024
The module struct initializer for xPrepareSql is wrong since commit d178de8 ("bugfix: reset modifications of `sqlite3_vtab` (#1027)") because it assings the xPrepareSql as the xIntegrity hook: ``` /home/runner/work/libsql/libsql/libsql-sqlite3/src/test8.c:1364:3: warning: initialization of 'int (*)(sqlite3_vtab *, const char *, const char *, int, char **)' from incompatible pointer type 'int (*)(sqlite3_vtab_cursor *, const char *)' [-Wincompatible-pointer-types] 1364 | echoPreparedSql, | ^~~~~~~~~~~~~~~ /home/runner/work/libsql/libsql/libsql-sqlite3/src/test8.c:1364:3: note: (near initialization for 'echoModuleV2.xIntegrity') ```
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 #865
Cause
Earlier, we had merged upstream changes from SQLite 3.44.0 to libsql. The upstream had modified
sqlite3_module
struct by adding a new fieldxIntegrity
. Prior to this, we had added a custom function fieldxPreparedSql
tosqlite3_module
. This change broke the crsqlite extension.To fix that, we added a new struct
libsql_module
and movedxPreparedSql
in it. We also added helper functions likelibsql_create_module
andlibsql_create_module_v2
. This change also prompted to modifysqlite3_vtab
by adding filed pointing tolibsql_module
. This fixed the crsqlite extension.Unfortunately, it broke sqlite-vss extension. The sqlite-vss extended the
sqlite3_vtab
struct by adding new fields, due to our change, the memory layout assumption changed and caused the issue.The broken commit: e56bdbd, PR of 3.44.0 merge: #625 (it also has more context and discussion)
Fix
I have reversed the
e56bdbd
commit, removed thelibsql_module
struct and the methods we had added. I movedxPreparedSql
back tosqlite3_module
and removed the erranous fieldlibsql_module
fromsqlite3_vtab
. Accordingly, I have modified crsqlite extension as well.To avoid similar regressions in future, I have added tests for both the extensions.
Follow up PR: tests for other extensions, add cargo cache to the github workflow, and general speed up tricks