Skip to content

Neo4j Compatibility: reduce(s = 0, x IN [] | s + x) #2292

@zihaozeng0021

Description

@zihaozeng0021

Configuration

AGE Version: apache/age:latest (pulled 2025-12-26)

Operating System: WSL2 – Ubuntu 24.04.1 LTS

Installation Method: Docker


Steps to reproduce

  1. Start AGE via Docker
docker run \
  --name age \
  -p 5455:5432 \
  -e POSTGRES_USER=postgresUser \
  -e POSTGRES_PASSWORD=postgresPW \
  -e POSTGRES_DB=postgresDB \
  -d \
  apache/age:latest
  1. Connect with psql
PGPASSWORD='postgresPW' psql -h localhost -p 5455 -U postgresUser -d postgresDB
  1. Run the following query
CREATE EXTENSION IF NOT EXISTS age;
LOAD 'age';
SET search_path = ag_catalog, "$user", public;

SELECT create_graph('test');

SELECT * FROM cypher('test', $$
  RETURN reduce(s = 0, x IN [] | s + x)
$$) AS (r agtype);

Expected behaviour

AGE aims to be 100% compatible with Neo4j wherever possible, so this query is expected to work as it does in Neo4j:

neo4j@neo4j> RETURN reduce(s = 0, x IN [] | s + x);
+--------------------------------+
| reduce(s = 0, x IN [] | s + x) |
+--------------------------------+
| 0                              |
+--------------------------------+

Actual behaviour

The query fails with:

ERROR:  syntax error at or near "|"
LINE 2:   RETURN reduce(s = 0, x IN [] | s + x)
                                       ^

Metadata

Metadata

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions