Skip to content

Entity RETURN DISTINCT followed by UNION fails with type with OID ... does not exist #2554

Description

@YGY-001

Reproduction

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

SELECT *
FROM ag_catalog.cypher('age_issue_case18', $$
CREATE (n {id: 1})
$$) AS (v agtype);

SELECT *
FROM ag_catalog.cypher('age_issue_case18', $$
MATCH (n)
RETURN DISTINCT n AS value
UNION ALL
RETURN null AS value
$$) AS (value agtype);

Expected

The query returns the matched vertex and one null row. UNION ALL permits
both rows, and null is a valid value for the same result column.

Actual

ERROR: type with OID 4026532032 does not exist

The numeric OID varies with the fresh database. It is generated internally;
there is no OID or type name in the Cypher input. The failure reproduces on a
fresh AGE 1.8.0 / PostgreSQL 18.6 graph.

Controls

The following queries succeed on the same graph:

MATCH (n)
RETURN n AS value
UNION ALL
RETURN null AS value
RETURN 1 AS value
UNION ALL
RETURN null AS value

The failure therefore requires the entity branch's RETURN DISTINCT path;
it is not a user-supplied missing-type or missing-OID error. The original
audit Cases 951, 1167, and 1888 are deduplicated under this one family. Case
1167 uses UNION ALL; Cases 951 and 1888 use the default UNION spelling.

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