Skip to content

Prefix filters can miss ASCII matches under collations with contractions #74724

Open

Description

@ehddnr301

Under which category would you file this issue?

Airflow Core

Apache Airflow version

3.4.0 (main at f31684af8596377142ecc587cd9b2030eac86a8b)

What happened and how to reproduce it?

The shared prefix matcher builds an upper bound by bumping the last character to the next code point. #74552 skips that bound when the bumped character is non-ASCII, but collations with contractions can break the code-point order for ASCII too.

On PostgreSQL 16.15 with the ICU cs-CZ-x-icu collation, ch sorts after h:

SELECT 'chata' < 'd' COLLATE "cs-CZ-x-icu"; -- false

So the prefix c (>= 'c' AND < 'd') misses chata.

  1. Save as dev/reproduce_prefix_czech.py:
from sqlalchemy import String, literal, select

from airflow import settings
from airflow.api_fastapi.common.parameters.search import _PrefixSearchParam

name = literal("chata", type_=String()).collate("cs-CZ-x-icu")
param = _PrefixSearchParam(name).set_value("c")
with settings.engine.connect() as connection:
    print(connection.scalars(param.to_orm(select(name))).all())
  1. Run it:
breeze run --backend postgres --postgres-version 16 python dev/reproduce_prefix_czech.py

Output: []

Drafted-by: Claude Code (Opus 5.5); reviewed by @ehddnr301 before posting

What you think should happen instead?

The prefix filter should return chata, since it starts with c.

Operating System

Debian GNU/Linux 12 (bookworm), Breeze CI container

Deployment

Docker-Compose

Apache Airflow Provider(s)

No response

Versions of Apache Airflow Providers

No response

Official Helm Chart version

Not Applicable

Kubernetes Version

No response

Helm Chart configuration

No response

Docker Image customizations

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. added
    kind:bugThis is a clearly a bug
    needs-triagelabel for new issues that we didn't triage yet
    on Oct 14, 2026
  2. kadubhumika commented on Oct 14, 2026

    @kadubhumika
    Contributor

    Hi team @ehddnr301 ,
    I would love to take a look at this issue and work on a fix for the _PrefixSearchParam collation bug.
    Since I have already contributed to Apache Airflow and successfully merged several PRs in the past, I am very familiar with the codebase and development workflow.
    Could you please assign this issue to me Or i should start work on it ? I will draft a Pull Request shortly.
    Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind:bugThis is a clearly a bugneeds-triagelabel for new issues that we didn't triage yet

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions