Skip to content

avg(toFloat(...)) followed by UNION fails with UNION types double precision and agtype cannot be matched #2553

Description

@YGY-001

Reproduction

LOAD 'age';
SET search_path = ag_catalog, public;
SELECT ag_catalog.create_graph('age_issue_case19');

SELECT *
FROM ag_catalog.cypher('age_issue_case19', $$
RETURN avg(toFloat(1)) AS value
UNION ALL
RETURN null AS value
$$) AS (value agtype);

Expected

The query returns two rows: 1.0 and null. The equivalent query is
accepted by Neo4j, and AGE can return the aggregate by itself.

Actual

ERROR: UNION types double precision and agtype cannot be matched

Controls

These queries succeed on the same fresh graph:

RETURN avg(toFloat(1)) AS value
RETURN toFloat(1) AS value
UNION ALL
RETURN null AS value

The failure is specific to combining the numeric aggregate result with a
UNION branch. It does not require a graph pattern, writes, an entity, or a
probe projection. Current-log Case 3197 and its full fixture reproduce this
error on AGE 1.8.0.

This is separate from #2525: #2525 requires a numeric aggregate to be used in
a CASE WHEN ... IS NULL THEN ... ELSE ... END expression and reports a
boolean conversion error. This reduction contains no CASE and fails during
UNION type resolution.

Environment

Apache AGE 1.8.0 on PostgreSQL 18.6, Docker image
apache/age:release_PG18_1.8.0.

Activity

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions