Skip to content

bug(/cypher): RETURN-alias unresolved in ORDER BY clause ("could not find rte for <alias>") #209

Description

@jphein

POST /cypher rejects a query that ORDER BYs a RETURN alias:

MATCH ()-[r:RELATION]->() RETURN r.relation_type AS rt, count(*) AS n ORDER BY n DESC

→ fails with could not find rte for n (the daemon's RETURN-alias parser doesn't resolve the aggregate alias n in ORDER BY).

WORKAROUND (in use): omit ORDER BY, sort client-side — works fine (SME Cat 4 exact-aggregation path does this, multipass#211).

Impact: low (client-side sort is trivial), but the verbatim cypher people copy from docs/AGE examples won't run. Fix = resolve RETURN aliases in the ORDER BY rewrite. Surfaced during the Cat 4 real-KG measurement work (the GROUP BY aggregation itself is fine + doesn't OOM; only the ORDER BY alias trips).

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