SKIP clause contradicts docs: error when using computed variable
Configuration
AGE Version: apache/age:latest (pulled 2025-12-07)
Operating System: WSL2 – Ubuntu 24.04.1 LTS
Installation Method: Docker
Steps to reproduce
- 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
- Connect with psql
PGPASSWORD='postgresPW' psql -h localhost -p 5455 -U postgresUser -d postgresDB
- Run the following query
CREATE EXTENSION IF NOT EXISTS age;
LOAD 'age';
SET search_path = ag_catalog, "$user", public;
SELECT create_graph('test_graph');
SELECT *
FROM cypher('test_graph', $$
WITH 1 AS skipAmount
UNWIND [1, 2] AS a
RETURN a
SKIP skipAmount
$$) AS (a agtype);
Expected behaviour
The query runs sucessfully
Actual behaviour
The query failed with the message:
ERROR: argument of SKIP must not contain variables
LINE 7: SKIP skipAmount
Key points:
- There is a contradiction between this result and the documentation.
- The documentation states
SKIPaccepts any expression that evaluates to a positive integer. - Expressions are combinations of variables and numbers, and the
skipAmountis a variable that is always 1 (a positive integer). However, the results state that the argument ofSKIPmust not contain variables.
@zihaozeng0021 Per the openCypher specification, only an expression can be used. An expression is not to be confused with a variable.
@jrgemignani I wish to further argue for the issue.
From a mathematical perspective, I am 100% sure that a variable can be considered an expression.
From a query language perspective, I’m not as certain, but here is a supporting documentation:
The Cypher Query Language Reference (Version 9) states that An expression in Cypher can be a variable (See page 36).
@zihaozeng0021 You can argue that all you want :) I would suggest taking it up with Neo4j who is the creator of Cypher :)
Unfortunately, in this particular case, an expression is just an expression, not a variable. Neo4j's documents state just that and if you use their docker container, it says just that when you enter your query. Apache AGE tries to be as close to 100% compatible with Neo4j where possible. The Boolean issue is an example of where we can't be.
Thanks for your suggestion.
I previously reported the same issue to Neo4j, but I haven’t received a response yet. I’ll update here once they accept or decline it.