tursodatabase / tursodatabase/libsql

Request: PRAGMA data_version support

Open
#2,233 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
17.2k
Forks
531
Avg merge
1h 12m
Merged PRs (30d)
1

Description

Use case

Building change-detection and pub/sub primitives on libsql (similar to Honker, pg_notify style queues, durable streams).

PRAGMA data_version is the critical dependency — it provides a version counter that increments on every commit, enabling:

  • Cross-process change detection via polling (1ms intervals)
  • Push-like async semantics without a broker
  • Detecting when another connection modified the DB

Currently libsql doesn't support PRAGMA data_version (shown in compatibility matrix as ❌).

Questions

  1. Why was data_version omitted? Architectural constraint, low priority, or something else?
  2. Would you accept a PR to implement it?
  3. Does it conflict with libsql's replication/distributed model?

For local-mode libsql (single DB file), data_version should be straightforward — it's a pager-level counter in SQLite. For libsql-server, it's trickier (need server-side tracking), but worth discussing.

Context

  • data_version exists in SQLite since 3.3.7
  • Used by better-sqlite3, Honker, and other change-tracking systems
  • WAL mode + data_version enables efficient cross-process notifications

Would love to know the reasoning. If there's a fundamental reason it can't/shouldn't be implemented, I can explore alternatives.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the compatibility matrix in COMPAT.md and the repository's pager-level handling of PRAGMA behavior. Determine whether the requested semantics apply to local mode, libsql-server, or both, then clarify the expected counter behavior and test coverage before implementation. Done means an agreed scope and a compatible data_version implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, rust
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.