Config for setting collation for attributes

未关闭
#650 6 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
elixir, postgresql
领域
databases

调研方向

没有指定文件或测试。首先追踪 Ash/Ecto 如何为 PostgreSQL 属性生成 ILIKE 过滤器,然后确定在不更改迁移的情况下,可以在哪里表示查询级排序规则。完成的标准是查询可以应用所请求的 COLLATE 表达式,并且能够与 Django 创建的非确定性排序规则一起工作,同时覆盖失败的过滤器用例。

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

描述

enhancement
Code of Conduct
  • I agree to follow this project's Code of Conduct
AI Policy
  • I agree to follow this project's AI Policy, or I agree that AI was not used while creating this issue.
Is your feature request related to a problem? Please describe.

When working with a shared PostgreSQL database that's also used by Django (since Django 4.2's deprecation of CITextField), you can't use ilike filters anymore on columns that Django has set up with nondeterministic collations.
Django deprecated CITextField and now prefers setting db_collation on regular text fields to handle case-insensitive comparisons. The problem is that when Django creates a column with one of these nondeterministic collations, PostgreSQL throws errors if you try to use LIKE or ILIKE operators on those columns.

To Reproduce

Have a Django app that creates a table with a text field using db_collation for case-insensitive matching
Try to query that table from Ash/Ecto using an ILIKE filter
PostgreSQL will error because ILIKE doesn't work with nondeterministic collations

Describe the solution you'd like

It would be nice to have a way to specify a collation on an Ash attribute that gets applied at the query level (not in migrations - we can't change the column definition since that would break Django). Something that would generate SQL like:

WHERE column_name COLLATE "default" ILIKE '%search%'

This way Ash could work with Django's collation setup without modifying the actual column definitions.

Describe alternatives you've considered

No response

Additional context

No response

主要语言
Elixir
星标
191
派生
186
平均合并
16 小时 4 分钟
30 天内合并 PR
17

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

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

ash-project/ash_postgres 的其他 Issue

查看 ash-project/ash_postgres 的全部 Issue

相似的 Issue

更多 Elixir Issue

把新 issue 发到你的邮箱

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