Skip to content
Permalink
Browse files
Added PL/PGQSQL Example Documentation
  • Loading branch information
JoshInnis committed Jan 17, 2022
1 parent 1315697 commit 3d3ae86d585e2e42657b26785eceb0f1e5e5f17a
Showing 1 changed file with 24 additions and 14 deletions.
@@ -2,17 +2,27 @@

Cypher commands can be run in [PL/pgSQL](https://www.postgresql.org/docs/11/plpgsql-overview.html) functions without restriction.

## Void PL/pgSQL





## Scalar Function

## SRF Function

## Dynamic Cypher



```
CREATE FUNCTION get_all_vertices()
RETURNS TABLE(vertex ag_catalog.agtype)
LANGUAGE plpgsql
AS $BODY$
BEGIN
LOAD 'age';
SET search_path TO ag_catalog;
RETURN QUERY
SELECT *
FROM ag_catalog.cypher('graph_name', $$
MATCH (v)
RETURN v
$$) AS (a ag_catalog.agtype);
END
$BODY$;
```

```
Developer's Note:
It's recommended that the LOAD 'age' command and setting the search_path in the function declaration, to ensure the CREATE FUNCTION command works consistently.
```

0 comments on commit 3d3ae86

Please sign in to comment.