Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Custom string collation: opt-in to trust the provider's order, so ordered windows page instead of loading the full source

Aperta
#2,240 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
database

Direzione di ricerca

Start with the custom string collation handling added in #1904, then trace requiresFullSource, computeSubscriptionOrderByHints, canExpressCursorOrder, and the cursor comparison functions. The issue describes tests for bounded first-page queries, collated cursor paging, untrusted collations, and comparison identity; use those cases to check that trusted provider ordering enables paging while the default remains unchanged.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Since #1904, a custom string collation ({ stringSort: 'custom', compare }) marks every ordered query requiresFullSource, and computeSubscriptionOrderByHints drops orderBy/limit. That is the safe default when the backend's order is unknown. But some backends order strings with exactly that collation: InstantDB answers ordered/limited queries in Postgres glibc en_US, and our comparator matches it row for row (verified on 5,519 live rows).

Today those backends have two options. They can sort lexically, which gives the wrong pages. Or they can use the custom collation, and then every ordered window, on any field, requests its whole filtered source, because the collection default applies to every clause.

Proposal: an opt-in on the custom collation:

defaultStringCollation: {
  stringSort: 'custom',
  compare: comparePostgresText,
  trustProviderOrder: true,
}

With it set:

  • requiresFullSource and the subscription hints treat the order as provider-pageable, as for lexical order.
  • canExpressCursorOrder accepts string values under it.
  • The cursor's gt/lt carry the collation, so local evaluation agrees with the provider. gt/gte/lt/lte take an optional CustomStringCollation third argument, stored on the Func (not as an argument, so query identity still hashes; its identity is canonicalized like an orderBy collation).

Index range optimization skips collated comparisons.

Without the flag nothing changes. We have this implemented on top of 0.15.2 with tests (bounded first page, collated cursor paging, untrusted collations unchanged, comparison identity), and the full @tanstack/db suite passes. Happy to open a PR.

Lingua principale
TypeScript
Stelle
3.9k
Fork
277
Merge medio
18h 7m
PR unite (30g)
228

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di TanStack/db

Tutte le issue di TanStack/db

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.