Problem
Several stores that run on SQLite issue INSERT ... RETURNING, which SQLite added in 3.35.0, but accept an engine on an older SQLite runtime. On such a runtime they start normally and fail the first time they write. Only the segment store checks: its params refuse a runtime below 3.35 with a message naming the version (_MIN_SQLITE_VERSION in episodic_memory/event_memory/segment_store/sqlalchemy_segment_store.py).
The RETURNING statements that can run on SQLite, as of 82b6c6f58 (main), paths under packages/server/src/memmachine_server/:
| Store |
Method |
Location |
SQLiteVectorStore |
upsert (every vector write) |
common/vector_store/sqlite_vector_store.py:297 |
SQLiteVecVectorStore |
upsert (every vector write) |
common/vector_store/sqlite_vec_vector_store.py:155 |
| SQLAlchemy episode store |
add_episodes |
common/episode_store/episode_sqlalchemy_store.py:228 |
| SQLAlchemy semantic config store |
create_set_type_category, create_category, add_tag, add_set_type_id |
semantic_memory/config_store/config_store_sqlalchemy.py:404, 511, 685, 751 |
| Vector-store semantic storage |
add_feature |
semantic_memory/storage/vector_store_semantic_storage.py:235 |
(sqlalchemy_pgvector_semantic.py also uses RETURNING, but runs on PostgreSQL only.)
Steps to reproduce
- Use a Python whose
sqlite3.sqlite_version is below 3.35, for example one built against an older system SQLite.
- Configure any of the stores above on SQLite.
- Write through it (add an episode, upsert a vector, add a semantic feature or category): the store is built without complaint, and its first
INSERT ... RETURNING fails on the SQLite runtime.
The segment store on the same runtime is refused when it is built, with its message naming the version.
This was not run on a pre-3.35 runtime; it follows from SQLite's release log (RETURNING is new in 3.35.0) and the statements above. SQLAlchemy 2.0.53 marks a runtime below 3.35 as lacking RETURNING but still sends an explicit .returning() (checked by turning those flags off on a 3.50 engine), so the statement reaches SQLite as written.
Expected behavior
Every store that needs RETURNING on SQLite refuses an older runtime when it is constructed, as the segment store does, with a message naming the runtime's version and the minimum.
Environment
- MemMachine:
main at 82b6c6f58
- Any Python whose bundled or linked SQLite is older than 3.35.0
🤖 Written by Claude Code (Claude Opus 5.5) on behalf of @edwinyyyu.
Problem
Several stores that run on SQLite issue
INSERT ... RETURNING, which SQLite added in 3.35.0, but accept an engine on an older SQLite runtime. On such a runtime they start normally and fail the first time they write. Only the segment store checks: its params refuse a runtime below 3.35 with a message naming the version (_MIN_SQLITE_VERSIONinepisodic_memory/event_memory/segment_store/sqlalchemy_segment_store.py).The
RETURNINGstatements that can run on SQLite, as of82b6c6f58(main), paths underpackages/server/src/memmachine_server/:SQLiteVectorStoreupsert(every vector write)common/vector_store/sqlite_vector_store.py:297SQLiteVecVectorStoreupsert(every vector write)common/vector_store/sqlite_vec_vector_store.py:155add_episodescommon/episode_store/episode_sqlalchemy_store.py:228create_set_type_category,create_category,add_tag,add_set_type_idsemantic_memory/config_store/config_store_sqlalchemy.py:404, 511, 685, 751add_featuresemantic_memory/storage/vector_store_semantic_storage.py:235(
sqlalchemy_pgvector_semantic.pyalso usesRETURNING, but runs on PostgreSQL only.)Steps to reproduce
sqlite3.sqlite_versionis below 3.35, for example one built against an older system SQLite.INSERT ... RETURNINGfails on the SQLite runtime.The segment store on the same runtime is refused when it is built, with its message naming the version.
This was not run on a pre-3.35 runtime; it follows from SQLite's release log (RETURNING is new in 3.35.0) and the statements above. SQLAlchemy 2.0.53 marks a runtime below 3.35 as lacking
RETURNINGbut still sends an explicit.returning()(checked by turning those flags off on a 3.50 engine), so the statement reaches SQLite as written.Expected behavior
Every store that needs
RETURNINGon SQLite refuses an older runtime when it is constructed, as the segment store does, with a message naming the runtime's version and the minimum.Environment
mainat82b6c6f58🤖 Written by Claude Code (Claude Opus 5.5) on behalf of @edwinyyyu.