bitnine-oss / agensgraph

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

Too many matches when searching for nodes with a relation to self #500

Open pebbe opened 4 years ago

pebbe commented 4 years ago

This works as expected:

match (e)-[r]->(e2) where e = e2 return r, e;

This should give the same result, but instead, it returns all relationships between any pair of items:

match (e)-[r]->(e) return r, e;
joefagan commented 4 years ago

Peter

Why do you think both queries should return the same result?

From memory, I think when identifiers are repeated the identifier will have values assigned only to its last appearance in the query.

So your second query will give identical results to Match (foo)-[]->(e) return r, e;

Thanks Joe

On Wed, 27 Nov 2019 at 16:52, Peter Kleiweg notifications@github.com wrote:

This works as expected:

match (e)-[r]->(e2) where e = e2 return r, e;

This should give the same result, but instead, it returns all relationships between any pair of items:

match (e)-[r]->(e) return r, e;

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bitnine-oss/agensgraph/issues/500?email_source=notifications&email_token=ALQMI2G6PVN4O6BIR7X5CKTQV2JU7A5CNFSM4JSI2NY2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H4OQFQA, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALQMI2FWTIE3JMWX3MMPVY3QV2JU7ANCNFSM4JSI2NYQ .

pebbe commented 4 years ago

When a variable is used multiple times, it represents the same item.

Neo4j handles this correctly.