protectione055 opened a new issue, #2049:
URL: https://github.com/apache/age/issues/2049
Environment:
PostgreSQL 16.3 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu
10.5.0-1ubuntu1~20.04) 10.5.0, 64-bit
Apache AGE 1.5.0
## Description:
I am trying to execute a BFS (Breadth-First Search) recursive query in
PostgreSQL using Apache AGE, but I keep encountering a syntax error. Below is
the SQL query I used:
```SQL
-- The query should return a result set with all nodes traversed in a
breadth-first manner starting from the node with extid = 1.
WITH RECURSIVE bfs AS (
SELECT id, extid, 1 AS level
FROM cypher('my_graph', $$
MATCH (n:Node {extid: 1})
RETURN id(n) AS id, n.extid AS extid
$$) AS (id agtype, extid agtype)
UNION ALL
SELECT e.end_id AS id, e.extid, p.level + 1 AS level
FROM bfs AS p
JOIN cypher('my_graph', $$
MATCH (n:Node)-[r:RELATION]->(m:Node)
WHERE id(n) = p.id
RETURN id(m) AS end_id, m.extid AS extid
$$) AS e(end_id agtype, extid agtype)
)
SELECT * FROM bfs;
```
The following error occurs when I try to execute the query:
```
ERROR: syntax error at or near ")"
LINE 17: )
```
According to the [Apache AGE
documentation](https://age.apache.org/age-manual/master/advanced/advanced.html),
using cypher queries within CTEs (Common Table Expressions) should be
supported without restrictions.
If there's a specific way to write recursive queries or if there's a known
issue with the recursive WITH clause in Apache AGE, I would appreciate guidance
on how to correct this.
Thank you!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]