Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

未关闭
#2,240 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
typescript
领域
database

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
TypeScript
星标
4k
派生
277
平均合并
18 小时 7 分钟
30 天内合并 PR
228

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

TanStack/db 的其他 Issue

查看 TanStack/db 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。