Skip to content

feat(electric-db-collection): support nested property references in SQL queries#1514

Open
miguelrk wants to merge 1 commit intoTanStack:mainfrom
miguelrk:feat-support-nested-property-refs-via-postgresql-json-operators
Open

feat(electric-db-collection): support nested property references in SQL queries#1514
miguelrk wants to merge 1 commit intoTanStack:mainfrom
miguelrk:feat-support-nested-property-refs-via-postgresql-json-operators

Conversation

@miguelrk
Copy link
Copy Markdown

@miguelrk miguelrk commented May 4, 2026

🎯 Changes

Extends @tanstack/electric-db-collection SQL compilation so multi-segment IR (intermediate representation) refs (nested property paths) work in WHERE and ORDER BY instead of throwing. Paths compile to PostgreSQL JSON / jsonb operators (-> for intermediate keys, ->> for the final key so the compared value is text).

Scope / limitations: nested paths assume JSON / jsonb extraction from a single root column; if the physical column isn’t JSON / jsonb, SQL may fail at runtime.

✅ Checklist

  • I have tested this code locally with pnpm test.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

…QL queries

- Implemented support for nested property references in WHERE and ORDER BY clauses by compiling to PostgreSQL JSON operators.
- Added new utility functions for escaping and quoting SQL string literals.
- Updated tests to cover various scenarios for nested JSON/jsonb references.
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.

1 participant