In agensgraph or postgresql, you can increase query reuse (the same query is executed without parsing)
by applying a bind variable($1) to the where condition value instead of a literal value with a prepare statement.
example)
PREPARE x(text) AS
SELECT * FROM ( match(a:person) WHERE a.name = $1 return properties(a)) as v;
EXECUTE x(933);
In age, the following error occurs when applying the bind variable ($1).
PREPARE x(text) AS
SELECT *
FROM cypher('graph_name', $$
MATCH (a:Person), (b:Person)
WHERE a.name = $1 AND b.name = 'Node B'
with a,b
match(a)-[e:RELTYPE]->(b)
where b.born > 1999
RETURN a
$$) as (a agtype);
ERROR: unexpected character at or near "$"
LINE 5: WHERE a.name = $1 AND b.name = 'Node B'
These queries are often implemented in development application environments.
Are there any rules for applying bind variables in age?
In agensgraph or postgresql, you can increase query reuse (the same query is executed without parsing)
by applying a bind variable($1) to the where condition value instead of a literal value with a prepare statement.
example)
PREPARE x(text) AS
SELECT * FROM ( match(a:person) WHERE a.name = $1 return properties(a)) as v;
EXECUTE x(933);
In age, the following error occurs when applying the bind variable ($1).
PREPARE x(text) AS
SELECT *
FROM cypher('graph_name', $$
MATCH (a:Person), (b:Person)
WHERE a.name = $1 AND b.name = 'Node B'
with a,b
match(a)-[e:RELTYPE]->(b)
where b.born > 1999
RETURN a
$$) as (a agtype);
ERROR: unexpected character at or near "$"
LINE 5: WHERE a.name = $1 AND b.name = 'Node B'
These queries are often implemented in development application environments.
Are there any rules for applying bind variables in age?