agensgraph
agensgraph copied to clipboard
Bug when use array_length() to limit var-length path's length
Environment
Agensgraph Version: 2.15.0 Operating System: window 11 Installation Method: Docker API: Docker
Steps to Reproduce
Execute the following query:
MATCH (n0)-[m0*1..1]->(n1)-[m1*]->(n2) WHERE array_length(m0)=1 AND array_length(m1)=1 RETURN *;
The output is Error:
ERROR: function array_length(edge[]) does not exist
LINE 1: MATCH (n0)-[m0*1..1]->(n1)-[m1*]->(n2) WHERE array_length(m0...
But when I execute:
MATCH (n0)-[m0*1..1]->(n1)-[m1*]->(n2), (n3 :L1)<-[r1 :T6]-(n4:L0) WHERE array_length(m0)=1 AND array_length(m1)=1 RETURN *;
I got the query result:
n0 | m0 | n1 | m1 | n2 | n3 | r1 | n4
----+----+----+----+----+----+----+----
(0 rows)
I'm not sure why does the second query (with an additional pattern (n3:L1)<-[r1:T6]-(n4:L0)) bypass the array_length() error and return empty results, while the first query fails? Is there a known workaround for this issue until a fix is released? Thank you for your attention to this matter.
@stupalpa I will look into this issue.
As a workaround, you can use length function.
MATCH (n0)-[m0*1..1]->(n1)-[m1*]->(n2) WHERE length(m0)=1 AND length(m1)=1 RETURN *;
Thanks for the workaround! The length function works perfectly.