Config for setting collation for attributes

Abierto
#650 6 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
elixir, postgresql
Área
databases

Línea de trabajo

No se nombran archivos ni tests. Empieza rastreando cómo Ash/Ecto genera filtros ILIKE para atributos de PostgreSQL y, después, determina dónde se puede representar una intercalación a nivel de consulta sin cambiar las migraciones. El trabajo estará terminado cuando las consultas puedan aplicar la expresión COLLATE solicitada y funcionar con intercalaciones no deterministas creadas por Django, con cobertura para el caso de filtro que falla.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
Elixir
Estrellas
191
Forks
186
Merge medio
16 h 4 min
PR fusionados (30 d)
17

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de ash-project/ash_postgres

Todos los issues de ash-project/ash_postgres

Issues similares

Más issues de Elixir

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.