-
Notifications
You must be signed in to change notification settings - Fork 145
Move identifier quoting to Electric client #1042
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Remove quoteIdentifier function from sql-compiler.ts so that Electric's encodeWhereClause can see the original unquoted identifiers and properly apply columnMapper transformations (e.g., camelCase → snake_case) before quoting. This fixes an issue where columnMapper encoding was not applied to subset queries because double-quoted identifiers were preserved by Electric's encodeWhereClause per PostgreSQL semantics. Fixes #1032
|
More templates
@tanstack/angular-db
@tanstack/db
@tanstack/db-ivm
@tanstack/electric-db-collection
@tanstack/offline-transactions
@tanstack/powersync-db-collection
@tanstack/query-db-collection
@tanstack/react-db
@tanstack/rxdb-db-collection
@tanstack/solid-db
@tanstack/svelte-db
@tanstack/trailbase-db-collection
@tanstack/vue-db
commit: |
|
Size Change: 0 B Total Size: 88.5 kB ℹ️ View Unchanged
|
|
Size Change: 0 B Total Size: 3.35 kB ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good in principal, but the e2e tests are failing and need investigating + changeset
…ent" This reverts commit a9a0e65.
200a3c7 to
00f7656
Compare
Add whereExpr and orderByExpr fields to compileSQL output alongside the
existing string-compiled where/orderBy fields. This enables Electric to:
1. Receive original column names (e.g., 'userId' not '"userId"')
2. Apply columnMapper transformations (e.g., userId → user_id)
3. Handle quoting correctly after transformation
The structured format uses a simple expression tree:
- { type: 'ref', column: string } - column reference
- { type: 'val', paramIndex: number } - parameter placeholder
- { type: 'func', name: string, args: [...] } - operator/function
Electric should prefer whereExpr/orderByExpr when present, falling back
to where/orderBy strings for backwards compatibility with older clients.
Related to #1032
|
closing in favor of electric-sql/electric#3629 |
Remove quoteIdentifier function from sql-compiler.ts so that Electric's encodeWhereClause can see the original unquoted identifiers and properly apply columnMapper transformations (e.g., camelCase → snake_case) before quoting.
This fixes an issue where columnMapper encoding was not applied to subset queries because double-quoted identifiers were preserved by Electric's encodeWhereClause per PostgreSQL semantics.
Fixes #1032
🎯 Changes
✅ Checklist
pnpm test:pr.🚀 Release Impact