apache / age

Graph database optimized for fast analysis and real-time data processing. It is provided as an extension to PostgreSQL.
https://age.apache.org
Apache License 2.0
2.84k stars 400 forks source link

How to assign cypher result to pgsql variable? #1933

Open NathanFrund opened 1 week ago

NathanFrund commented 1 week ago

Hello!

I have a pretty basic cypher function whose result I'd like to assign to a pgsql variable.

Here is the mentioned query.

LOAD 'age';
SET search_path = ag_catalog, "$user", public;

SELECT exists
FROM cypher('test_graph', $$
    MATCH (n:Node)
    RETURN exists((n)-[:START]->())
$$) as (exists agtype);

I'm stumped.

In a way, I hope that the answer is obvious, but not too obvious!

NathanFrund commented 1 week ago

In the event that someone else has the same question:

https://age.apache.org/age-manual/master/advanced/plpgsql.html