bitnine-oss / agensgraph

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

WHERE id(edge)=any(array[id1,id2,id3]) statement return error #494

Closed zzl221000 closed 4 years ago

zzl221000 commented 5 years ago

In my business, I get a batch of wrong edge ids based on criteria, I want to delete them in bulk. However, any(array[]) prompts me that there is an error. Is there any other way?

joefagan commented 5 years ago

The syntax should be ANY (x in array[] WHERE x = expr); IE the 'where' is inside the ANY() Please include code snippet.

zzl221000 commented 5 years ago

use any

expression operator ANY (array expression) match (n:rlnode {rlid:'bd2ef4ac89b0a4eea63bac9507c633f9'} )-[e:knows]-(:rlnode) WHERE to_jsonb(id(e)) = any(array['6.545450570']) RETURN e; return ERROR: syntax error at or near "array" LINE 2: ...[e:knows]-(:rlnode) WHERE to_jsonb(id(e)) = any(array['6.5...

use in

double

expression IN (value [, ...]) match (n:rlnode {rlid:'bd2ef4ac89b0a4eea63bac9507c633f9'} )-[e:knows]-(:rlnode) WHERE to_jsonb(id(e)) in ('6.545450570','6.545450570') RETURN e; return ERROR: syntax error at or near "," LINE 2: ...:rlnode) WHERE to_jsonb(id(e)) in ('6.545450570','6.545450...

single

but use where in ('6.545450570') no error
@joefagan

erik-overdahl commented 4 years ago
MATCH (n:r1node {r1id:'b...'})-[e:knows]->(:r1node)
WHERE ANY(x IN [6.1, 6.2] WHERE id(e)=x)
RETURN e;
zzl221000 commented 4 years ago

Thanks @erik-overdahl