Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

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

Ouverte
#2,240 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
48/100
Type d'issue
Fonctionnalité
Clarté
Plutôt claire
Activité
Active
Stack technique
typescript
Domaine
database

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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.

Langage dominant
TypeScript
Étoiles
3.9k
Forks
277
Merge moyen
18 h 7 min
PR mergées (30 j)
228

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de TanStack/db

Toutes les issues de TanStack/db

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.