Skip to content

Refuse a SQLite runtime older than 3.35 in every store that uses RETURNING #1726

Description

@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_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

  1. Use a Python whose sqlite3.sqlite_version is below 3.35, for example one built against an older system SQLite.
  2. Configure any of the stores above on SQLite.
  3. 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions