Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

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

Aberta
#2,240 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
48/100
Tipo de issue
Funcionalidade
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
typescript
Domínio
database

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
TypeScript
Estrelas
4k
Forks
277
Merge médio
18h 7min
PRs com merge (30d)
228

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de TanStack/db

Todas as issues de TanStack/db

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.