Skip to content

Add primary key support for procedural views to rust and ts modules#5111

Draft
joshua-spacetime wants to merge 1 commit into
masterfrom
joshua/proc-view-pks
Draft

Add primary key support for procedural views to rust and ts modules#5111
joshua-spacetime wants to merge 1 commit into
masterfrom
joshua/proc-view-pks

Conversation

@joshua-spacetime
Copy link
Copy Markdown
Contributor

@joshua-spacetime joshua-spacetime commented May 23, 2026

Description of Changes

Adds support for primary keys to procedural views in rust and typescript modules. Now clients can receive update events when subscribed to such views.

Note, care must be taken to ensure that the view never returns duplicate primary keys, or else it will fail which will currently result in the transaction that triggered the view refresh to be rolled back. Better error handling for this exact scenario will be added in a separate follow up patch.

TODO: Currently in draft because it needs to be cleaned up a bit, and I may decide to split the typescript changes into their own PR.

API and ABI breaking changes

None, although adding a primary key to an existing view will require a client update.

Expected complexity level and risk

3

Testing

Compile-time failure scenarios:

  • Primary key on non-existent column
  • Primary key doesn't reference custom accessor name (for rust)
  • Multiple primary key columns specified (typescript)

SDK tests:

  • OnUpdate
  • OnUpdate is sender-scoped

Smoketests:

  • Modifying primary key columns breaks clients (auto-migrations)

@joshua-spacetime joshua-spacetime linked an issue May 23, 2026 that may be closed by this pull request
@joshua-spacetime joshua-spacetime self-assigned this May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Procedural view primary keys

1 participant