bitnine-oss / agensgraph

AgensGraph, a transactional graph database based on PostgreSQL
http://www.agensgraph.org
Other
1.33k stars 148 forks source link

feature or bug? -- infinite path has minimum length of 1 #527

Open pebbe opened 3 years ago

pebbe commented 3 years ago

The AgensGraph Developer Manual has this example and calls it an infinite path:

(a)-[*]->(b)

I assumed, this meant a path of any length, but as it turns out, this is a path with a minimum length of 1. See:

peter=# match (:node{id:1})-[r:rel*]->(:node{id:1}) return r limit 1;
 r 
---
(0 rows)

peter=# match (:node{id:1})-[r:rel*0..]->(:node{id:1}) return r limit 1;
 r  
----
 []
(1 row)

So * means length 1 or longer, and *0.. means any length.

Is this working as intended, or is it a bug?

It should be documented in the AgensGraph Developer Manual what the exact meaning of a bare * is.

I also searched for documentation on openCypher and Neo4j, but I could find no mention of any lower bound.