Config for setting collation for attributes

オープン
#650 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
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分
マージ済み PR(30日)
17

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ash-project/ash_postgres のほかの issue

ash-project/ash_postgres の issue をすべて見る

似ている issue

Elixir の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。