Skip to content

Unicode prefix ranges can exclude matches under libc collation #74551

Open

Description

@ehddnr301

Under which category would you file this issue?

Airflow Core

Apache Airflow version

main at fe589528ee46f9afdc2060ef14452a855cfbab30 (the shared prefix matcher is unchanged in the local Dag-list patch).

What happened and how to reproduce it?

The shared prefix matcher derives an upper bound by incrementing a Unicode code point. Under PostgreSQL libc en_US.utf8 collation, searching for 카페 excludes 카페매출집계. The substring-equality condition cannot recover a row already excluded by the range predicates.

Reproduced with PostgreSQL 16.15 and Python 3.11 in Breeze. The PostgreSQL server must have the libc en_US.utf8 collation available.

  1. Save this script as dev/reproduce_prefix.py in an Airflow checkout:
from sqlalchemy import String, literal, select

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

name = literal("카페매출집계", type_=String()).collate("en_US.utf8")
param = _PrefixSearchParam(name).set_value("카페")
with settings.engine.connect() as connection:
    print("Before filtering:", connection.scalars(select(name)).all())
    print("After filtering:", connection.scalars(param.to_orm(select(name))).all())
  1. Run it:
breeze run --python 3.11 --backend postgres --postgres-version 16 python dev/reproduce_prefix.py

Observed output:

Before filtering: ['카페매출집계']
After filtering: []

This reproduces the shared predicate without requiring existing metadata rows.

What you think should happen instead?

The prefix filter should return 카페매출집계. Its name begins with 카페.

Operating System

Airflow: Debian GNU/Linux 12 (bookworm), Breeze CI container.
PostgreSQL: 16.15 (Debian 16.15-1.pgdg13+2), x86_64 Linux.

Deployment

Docker-Compose (Breeze development environment)

Apache Airflow Provider(s)

Not applicable; the reproduction uses the core shared prefix matcher.

Versions of Apache Airflow Providers

Not applicable.

Official Helm Chart version

Not Applicable

Kubernetes Version

Not Applicable

Helm Chart configuration

Not Applicable

Docker Image customizations

Breeze CI image with the current checkout mounted; no custom image changes were needed for this reproduction.

Anything else?

A separate patch fixes Dag list display-name searches. This issue tracks the remaining shared matcher and its other consumers, including XCom Dag display-name searches.

The shared fix should preserve input handling and collation equality semantics, include an explicit libc-collation regression test, and check indexed-search performance across supported databases. Simply dropping Unicode upper bounds can substantially broaden index scans.

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

The current contribution is limited to Dag list searches; this issue tracks the broader follow-up.

Code of Conduct


Drafted-by: Codex (GPT-6)

Activity

  1. boring-cyborg commented on Oct 11, 2026

    @boring-cyborg

    Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.

  2. ehddnr301 commented on Oct 13, 2026

    @ehddnr301
    Author

    The same issue reproduces in several other *_prefix_pattern filters.

    Environment: Breeze, PostgreSQL 16.15, database default collation en_US.utf8.
    Stored value: 카페매출집계; search term: 카페.

    Result counts:

    Endpoint *_pattern *_prefix_pattern
    GET /api/v2/dagTags (tag_name_…) 1 0
    GET /api/v2/dags/~/dagRuns (triggering_user_name_…) 1 0
    GET /api/v2/eventLogs (owner_display_name_…, owner_…) 1 0
    GET /api/v2/assets (name_…) 1 0

    Additional column-level checks, without going through the corresponding APIs, reproduced this for asset group, asset alias name, task display name, rendered map index, dag_id, task_id, operator name, partition key, connection ID, variable key, pool name, XCom key, and import error filename.

    In the cases tested on PostgreSQL, matching rows were missed when the search prefix ended in a non-ASCII character (e.g. 카페, 김, café), whereas München, which contains ü but ends in ASCII n, matched correctly. SQLite was unaffected in these tests.


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

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions